Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given an array of ~ n ~ positive integers ~ a_1, a_2, a_3, \ldots, a_{n-1}, a_n ~.
Requirement: Determine how many pairs of equal numbers there are (~ a_i = a_j ~ with ~ i < j ~).
Input
- The first line contains the length ~ n ~ of the array (~ 1 \leq n \leq 10^5 ~).
- The second line contains ~ n ~ integers ~ a_1, a_2, a_3, \ldots, a_n ~ (~ 1 \leq a_i \leq 10^6 ~), separated by spaces.
Output
- An integer representing the number of equal pairs.
Sample Input
7
6 2 4 2 4 3 4
Sample Output
4
Bình luận