#P4670. Examination of Similar File Pairs

    ID: 17916 Type: Default 1000ms 256MiB

Examination of Similar File Pairs

Examination of Similar File Pairs

The jury wants to filter out file pairs that are obviously very different in size before checking for plagiarism. Given (N) files with sizes (f_1, f_2, \dots, f_N), they will only compare two files ( (f_i, f_j) ) (with (i \neq j) and assuming (size(f_i) \leq size(f_j))) if the smaller file satisfies (size(f_i) \geq 0.9 \times size(f_j)). In other words, if the smaller file is at least 90% of the size of the larger one, the pair will be examined. Your task is to compute the number of file pairs that will be examined.

inputFormat

The first line contains an integer (N), the number of files. The second line contains (N) space-separated integers, where each integer represents the size of a file.

outputFormat

Output a single integer representing the total number of pairs of files that must be examined.

sample

4
1 1 1 1
6

</p>