447. Number of Good Pairs
EasyCounting
Count the pairs i < j with a[i] = a[j].
Input format
Line 1: n Line 2: n integers
Output format
The count.
Example 1
Input
6 1 2 3 1 1 3
Output
4
Example 2
Input
4 1 1 1 1
Output
6
Constraints
1 ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…