Guards

Count the subsets of at least two applicants with pairwise coprime favorite numbers, modulo 1,000,000,007.

Hard8Dynamic programmingNumber theoryCombinatoricsNo attempts yetTime limit2sMemory limit32 MB

Problem

Sangsu bought a huge house yesterday. He advertised for guards to watch it, n people applied, and he numbered the applicants 1 to n.

Applicant i has a favorite number aia_i, which is a positive integer. When applicants i and j stand guard together and the greatest common divisor of aia_i and aja_j is 2 or more, the two feel close, talk all night, and fail to watch the house.

Sangsu hires at least 2 applicants, and he wants every pair among the hired applicants to have favorite numbers whose greatest common divisor is 1. Count how many ways he can hire. Two ways are different when the sets of hired numbers are different. Two applicants with the same favorite number are different people, but they cannot be hired together, because their greatest common divisor equals that number and is at least 2.

Input

The first line has the number of applicants n. (2n22222 \le n \le 2222)

The second line has a1,a2,,ana_1, a_2, \dots, a_n in order, separated by spaces. (1ai22221 \le a_i \le 2222)

Output

Print the number of ways to hire, taken modulo 1,000,000,007(=109+7=10^9+7).