P27382 [AtCoder] 400 Billion Cell Calculation
NOI
题目描述

Problem Description

Given an integer sequence $A$ of length $N$.
Takahashi wrote the value of $A_i - A_j$ in the cell at the $i$-th row and $j$-th column of an $N \times N$ grid.
How many different values are written in this grid?

Input Format

The input is given from the standard input in the following format:

$ N $ $ A_1 $ $ A_2 $ $\dots$ $ A_N $

Output Format

Output the answer as an integer.

Sample Input and Output

Sample Input #1

3
5 2 3

Sample Output #1

7

Sample Input #2

10
13 21 34 55 89 1 2 3 5 8

Sample Output #2

75

Notes/Hints

Constraints

  • All inputs are integers.
  • $1 \le N \le 2 \times 10^5$
  • $1 \le A_i \le 2 \times 10^5$

Sample Explanation 1

After the numbers are written, the grid looks like the following, containing 7 different values. ![](https://img.atcoder.jp/ghi/3572e96c66220ab11628d3b6e0bb6eff.png)

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 5 2 3
样例输出
7