TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

The participants of theWorld Programming Competition submitted N solution files f1, ..., fN 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 (fi, fj) where i ≠ j, size(fi) ≦ size(fj) and size(fi) ≧ 0.9.size(fj).


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(f1), ..., size(fN), each showing the size of one file.


1 ≦ N ≦ 100000

1 ≦ size(fi) ≦ 100000000

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 1

2
2 1
5
1 1 1 1 1

Sample Output 1

0
10

Hints

In the second example, each file has to be compared to each other (but each pair only once, not twice,
of course).

Problem Source

Migrated from old NTUJ.

BOI2011 Competition day 2

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200