#K51422. Distinct Angles
Distinct Angles
Distinct Angles
You are given an integer n and a list of n integers representing angles. Two angles are considered the same if their absolute values are equal. Your task is to determine the total number of distinct angles when considering the absolute value.
Note: Angles that are opposites (e.g., 30 and -30) are counted as one unique angle.
Constraints:
- 1 ≤ n ≤ 1,000,000
- −180 ≤ angle ≤ 180
Input Format: The first line contains an integer n, the number of angles. The second line contains n space-separated integers representing the angles.
Output Format: Print a single integer representing the number of distinct absolute angles.
Examples:
Input: 5 -30 30 60 -60 15 Output: 3</p>Input: 4 45 -45 90 -90 Output: 2
The mathematical formulation of a distinct angle is given by the following formula in LaTeX:
\( \text{distinct} = \left|\{ |a_i| : i=1,2,\dots,n \}\right| \)
inputFormat
The input is read from standard input and consists of two lines. The first line contains an integer n (the number of angles). The second line contains n space-separated integers representing the angles.
outputFormat
The output is a single integer printed to standard output representing the total number of distinct absolute angles.
## sample5
-30 30 60 -60 15
3