GCD Subset Challenge

Time limit: 2 secMemory limit: 256 MBMath, Dynamic Programming

Problem Statement

In the ancient Kingdom of Rhun, mathematicians believed that numbers possessed magical properties when combined in the right way. During the annual Festival of Numbers, villagers are challenged to create groups from a given set of mystical integers. The challenge is to form a non-empty subset of these integers such that the greatest common divisor (GCD) of the subset equals 11. Only those groups with gcd=1\gcd=1 are said to invoke the ancient magic.

Your task is to help the villagers determine the number of ways to choose a non-empty subset from the given array of integers such that the GCD of all the numbers in that subset is exactly 11. Since the number of possible subsets can be huge, report the answer modulo 109+710^9+7.

Input Format

  • The first line contains a single integer nn (1n1051 \leq n \leq 10^5), representing the number of integers.
  • The second line contains nn space-separated positive integers a1,a2,,ana_1, a_2, \dots, a_n where each aia_i satisfies 1ai1051 \leq a_i \leq 10^5.

Output Format

  • Output a single integer representing the number of non-empty subsets with gcd=1\gcd=1, taken modulo 109+710^9+7.

Examples

Input

3
1 2 3

Output

5

Input

4
2 4 8 16

Output

0

Code Editor

Submit a solution. Authentication is required to create submissions.

Language
Theme
Source code is submitted to the judge for testing.