Codeforces Round 325 (Div. 1) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

combinatorics

math

number theory

*2900

No tag edit access

The problem statement has recently been changed. View the changes.

×
E. Present for Vitalik the Philatelist

time limit per test

5 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputVitalik 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 10^{9} + 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.

Input

The first line of the input contains integer *n* (2 ≤ *n* ≤ 5·10^{5}) — the number of distinct stamps, available for sale in the 'Robin Bobin' store.

The second line contains a sequence of integers *a*_{1}, *a*_{2}, ..., *a*_{n} (2 ≤ *a*_{i} ≤ 10^{7}), where *a*_{i} is the price of the *i*-th stamp.

Output

Print a single integer — the remainder of the sought number of situations modulo 10^{9} + 7.

Examples

Input

3

2 3 2

Output

5

Input

2

9 6

Output

0

Note

In the first sample the following situations are possible:

- Vitalik buys the 1-st stamp, the store gives him the 2-nd stamp as a present;
- Vitalik buys the 3-rd stamp, the store gives him the 2-nd stamp as a present;
- Vitalik buys the 2-nd stamp, the store gives him the 1-st stamp as a present;
- Vitalik buys the 2-nd stamp, the store gives him the 3-rd stamp as a present;
- Vitalik buys the 2-nd stamp, the store gives him the 1-st and 3-rd stamps as a present.

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/11/2023 06:31:12 (k3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|