P28812 [洛谷] [BalticOI 2011 Day2] Plagiarism
普及+
题目描述

Problem Description

The participants of the World Programming Competition submitted \( N \) solution files \( f_1, \ldots, f_N \) to the grading system. Before accepting the results as final, the jury would like to rule out any possibility of plagiarism. They have a program that takes two files and compares them to decide if they are too similar to each other.

However, the number of files is rather big and it would take too much time to compare all pairs. On the other hand, many pairs could be quickly eliminated based on the fact that the file sizes are too different.

More precisely, the jury decided to fully skip comparing every pair where the size of the smaller file is less than 90% of the size of the larger one. So, the comparison program has to examine only those distinct pairs of files \( (f_i, f_j) \) where \( i \neq j \), \( size(f_i) \leq size(f_j) \), and \( size(f_i) \geq 0.9 \times size(f_j) \).

Write a program that computes the number of pairs of files that will have to be examined.

Input Format

The first line of input contains the integer \( N \), the number of solution files submitted. The second line contains \( N \) integers \( size(f_1), \ldots, size(f_N) \), each showing the size of one file.

Output Format

The first and only line of output must contain one integer, the number of pairs of files that will have to be examined.

Sample Input and Output

Sample Input #1

2
2 1

Sample Output #1

0

Sample Input #2

5
1 1 1 1 1

Sample Output #2

10

Notes/Hints

For 50% of the test cases, \( 1 \leq N \leq 2000 \).

For all test cases, \( 1 \leq N \leq 10^5 \), \( 1 \leq f_i \leq 10^8 \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2 1
样例输出
0