AtCoder Beginner Contest 206(Sponsored by Panasonic)
C
Swappable
AtCoder
⌀ 60
原题
← BD →
翻译中…

Problem Statement

翻译中…

Given an array of $N$ integers $A=(A_1,A_2,...,A_N)$, find the number of pairs $(i,j)$ of integers satisfying all of the following conditions:

翻译中…
  • $1 \le i < j \le N$
  • $A_i \neq A_j$
翻译中…

Constraints

翻译中…
  • All values in input are integers.
  • $2 \le N \le 3 \times 10^5$
  • $1 \le A_i \le 10^9$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 \dots A_N

翻译中…

Output

翻译中…

Print the answer as an integer.

翻译中…

样例

Input #1
3
1 7 1
Output #1
2
In this input, we have $A=(1,7,1)$. - For the pair $(1,2)$, $A_1 \neq A_2$. - For the pair $(1,3)$, $A_1 = A_3$. - For the pair $(2,3)$, $A_2 \neq A_3$.
Input #2
10
1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000
Output #2
45
Input #3
20
7 8 1 1 4 9 9 6 8 2 4 1 1 9 5 5 5 3 6 4
Output #3
173
题目信息
题号
abc206_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。