## ECOO '19 R3 P1 - Chords

View as PDF

Points: 7 (partial)
Time limit: 13.0s
Memory limit: 512M

Problem type

Francesco has created his own piano-like instrument with keys that each produce a unique frequency. One of his favourite things to do with the instrument is to play chords: a pair of keys where the frequency of one key is a multiple of the other. For example, the pair of frequencies is a pair, but is not. Francesco does not want to keep playing the same chords all the time, so he would like to know how many different chords can be played using his instrument. Two chords are different if one contains a key that the other does not. Can you help him figure out how many chords can be played?

#### Input Specification

The input will contain 10 datasets. Each dataset begins with a line containing an integer , the number of keys. The next line contains distinct integers , the frequency of each key.

For the first 4 cases, .

#### Output Specification

For each dataset, output the number of chords that can be played.

#### Sample Input (Two Datasets Shown)

4
2 4 6 8
3
3 4 12

#### Sample Output

4
2

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org