1320: 数对统计

Memory Limit:256 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:18 Solved:7

Description

给定 $n$ 个数字 $a_1,a_2,…,a_n$,从 $1$ 到 $n$ 中挑出 $i$ 与 $j$ 并要求 $i<j$,将 $a_i$ 与 $a_j$ 组成一个有序的序对 $(a_i,a_j)$。

请统计,能从序列中挑选出多少种互不相等的数对?两个数对 $(x,y)$ 与 $(p,q)$ 称之为不相等,是指 $x \neq p$ 或 $y \neq q$。

Input

- 第一行,单个整数 $n$
- 第二行,$n$ 个整数 $a_1,a_2,…,a_n$

Output

- 单个整数:表示互不相等的数对数量

Sample Input Copy

4
3 1 3 2

Sample Output Copy

5

HINT

样例说明

共有 $5$ 对: $(3,1),(3,3),(3,2),(1,3),(1,2)$


数据范围

- 对于 $30\%$ 的数据,$n \le 10$
- 对于 $60\%$ 的数据,$n \le 1000$
- 对于 $100\%$ 的数据,$1 \le n \le 100000$
- $1 \le a_i \le n$
 

Source/Category