Codeforces Round 325 (Div. 1) |
---|
Finished |
Vitalik the philatelist has a birthday today!
As he is a regular customer in a stamp store called 'Robin Bobin', the store management decided to make him a gift.
Vitalik wants to buy one stamp and the store will give him a non-empty set of the remaining stamps, such that the greatest common divisor (GCD) of the price of the stamps they give to him is more than one. If the GCD of prices of the purchased stamp and prices of present stamps set will be equal to 1, then Vitalik will leave the store completely happy.
The store management asks you to count the number of different situations in which Vitalik will leave the store completely happy. Since the required number of situations can be very large, you need to find the remainder of this number modulo 109 + 7. The situations are different if the stamps purchased by Vitalik are different, or if one of the present sets contains a stamp that the other present does not contain.
The first line of the input contains integer n (2 ≤ n ≤ 5·105) — the number of distinct stamps, available for sale in the 'Robin Bobin' store.
The second line contains a sequence of integers a1, a2, ..., an (2 ≤ ai ≤ 107), where ai is the price of the i-th stamp.
Print a single integer — the remainder of the sought number of situations modulo 109 + 7.
3
2 3 2
5
2
9 6
0
In the first sample the following situations are possible:
Name |
---|