Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.

Two ways are considered different if sets of indexes of elements chosen by these ways are different.

Since the answer can be very large, you should find the answer modulo 10^9 + 7.


-----Input-----

First line contains one integer n (1 ≤ n ≤ 10^5) — the number of elements in the array.

Second line contains n integers a_{i} (1 ≤ a_{i} ≤ 70) — the elements of the array.


-----Output-----

Print one integer — the number of different ways to choose some elements so that their product is a square of a certain integer modulo 10^9 + 7.


-----Examples-----
Input
4
1 1 1 1

Output
15

Input
4
2 2 2 2

Output
7

Input
5
1 2 4 5 8

Output
7



-----Note-----

In first sample product of elements chosen by any way is 1 and 1 = 1^2. So the answer is 2^4 - 1 = 15.

In second sample there are six different ways to choose elements so that their product is 4, and only one way so that their product is 16. So the answer is 6 + 1 = 7.

Difficulty: interview

Starter code:

Solutions:
def getmask(x):
    ans = 0
    for i in range(2, x + 1):
        while x % (i * i) == 0:
            x //= i * i
        if x % i == 0:
            ans ^= 1 << i
            x //= i
    return ans

def main():
    maxn = 71
    n = int(input())
    a = [int(i) for i in input().split()]
    cnt = [0] * maxn
    for i in a:
        cnt[i] += 1
    masks = {}
    for i in range(1, maxn):
        if cnt[i]:
            masks[getmask(i)] = masks.get(getmask(i), 0) + cnt[i]
    while len(masks) > 1 or 0 not in masks:
        if not masks:
            print(0)
            return
        fixed = max(masks.keys())
        for i in list(masks.keys()):
            if i ^ fixed < i:
                masks[i ^ fixed] = masks.get(i ^ fixed, 0) + masks[i]
                masks[i] = 0
        masks[0] = masks.get(0, 0) + masks[fixed] - 1
        masks[fixed] = 0
        masks = {i: j for i, j in list(masks.items()) if j > 0}
    print(pow(2, masks[0], 10**9+7) - 1)
    
    
    
main()


from collections import defaultdict
def getmask(x):
    ans = 0
    for i in range(2, x + 1):
        while x % i == 0:
            x //= i
            ans ^= 1 << i
    return ans

def main():
    maxn = 71
    n = int(input())
    a = [int(i) for i in input().split()]
    cnt = [0] * maxn
    for i in a:
        cnt[i] += 1
    masks = defaultdict(int)
    for i in range(1, maxn):
        masks[getmask(i)] += cnt[i]
    while masks[0] != sum(masks.values()):
        fixed = max(i for i in masks if masks[i])
        masks[0] -= 1
        for i in list(masks.keys()):
            if i ^ fixed < i:
                masks[i ^ fixed] += masks[i]
                masks[i] = 0
    print(pow(2, masks[0], 10**9+7) - 1)
    
    
    
main()


n = int(input())
a = set(map(int, input().split()))
s = []
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
for i in a:
    b = 0
    for j in p:
        while i % j == 0:
            i //= j
            b ^= 1 << j
    for j in s:
        b = min(b, b ^ j)
    if b > 0:
        s.append(b)
print(pow(2, n - len(s), 10 ** 9 + 7) - 1)

n = int(input())
s = []
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
for i in set(map(int, input().split())):
    b = 0
    for j in p:
        while i % j == 0:
            i //= j
            b ^= 1 << j
    for j in s:b=min(b,b^j)
    if b>0:s.append(b)
print(pow(2, n - len(s), 10 ** 9 + 7) - 1)


n = int(input())
a = set(map(int, input().split()))
s = []
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
for i in a:
    b = 0
    for j in p:
        while i % j == 0:
            i //= j
            b ^= 1 << j
    for j in s:
        b = min(b, b ^ j)
    if b > 0:
        s.append(b)
print(pow(2, n - len(s), 10 ** 9 + 7) - 1)

from collections import *

l = int(input())
c = Counter(map(int, input().split()))
t = defaultdict(int)
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]

for k, s in c.items():
    d = 0
    for i, q in enumerate(p):
        while k % q == 0:
            k //= q
            d ^= 1 << i
    t[d] += s

u = defaultdict(int)
u[0] = 1

for x in t:
    if x: l -= 1
    if 0 < x < 2048:
        v = u.copy()
        for y in u: v[x ^ y] += u[y]
        u = v

e = 1000000007
print((u[0] * pow(2, l, e) - 1) % e)

n = int(input())
s = []
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
for k in set(map(int, input().split())):
    d = 0
    for q in p:
        while k % q == 0:
            k //= q
            d ^= 1 << q
    for j in s: d = min(d, d ^ j)
    if d: s.append(d)
print(pow(2, n - len(s), 1000000007) - 1)

n = int(input())

s = []

p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]

for k in set(map(int, input().split())):

    d = 0

    for q in p:

        while k % q == 0:

            k //= q

            d ^= 1 << q

    for j in s: d = min(d, d ^ j)

    if d: s.append(d)

print(pow(2, n - len(s), 1000000007) - 1)



# Made By Mostafa_Khaled


n = int(input())
a = set(map(int, input().split()))
s = []
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
for i in a:
    b = 0
    for j in p:
        while i % j == 0:
            i //= j
            b ^= 1 << j
    for j in s:
        b = min(b, b ^ j)
    if b > 0:
        s.append(b)
print(pow(2, n - len(s), 10 ** 9 + 7) - 1)

n = int(input())
*a, = map(int, input().split())
mod = 1000000007
d = []
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
b = [0, 4, 8, 0, 32, 12, 128, 4, 0, 36,2048, 8, 8192, 132, 40, 0, 131072, 4, 524288, 32, 136, 2052, 8388608, 12, 0, 8196, 8, 128, 536870912, 44, 2147483648, 4, 2056, 131076, 160, 0, 137438953472, 524292, 8200, 36, 2199023255552, 140, 8796093022208, 2048,32, 8388612, 140737488355328, 8, 0,4, 131080, 8192, 9007199254740992, 12, 2080, 132, 524296, 536870916, 576460752303423488, 40, 2305843009213693952, 2147483652, 128, 0, 8224, 2060, 147573952589676412928, 131072, 8388616, 164]
for i in set(a):
    c = b[i - 1]
    for j in d:
        c = min(c, c ^ j)
    if c > 0:
        d.append(c)
print(pow(2, n - len(d), mod) - 1)

from sys import stdin


def find_prime(max_value):
    assert max_value >= 2
    result = [2]
    for i in range(3, max_value):
        state = 1
        for item in result:
            if item * item > i:
                break
            elif i % item == 0:
                state = -1
                break
        if state == 1:
            result.append(i)
    return result


module = int(10e8) + 7

n = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
number = [0 for i in range(70)]
for item in A:
    number[item - 1] += 1

prime_list = find_prime(70)

prime_map = {}
for i in range(2, 70 + 1):
    result = 0
    for item in prime_list:
        cur = i
        num = 0
        while cur % item == 0:
            num += 1
            cur = int(cur / item)
        result = result * 2 + num % 2
    prime_map[i] = result

number_dic = {0: 1}
sum_time = 0
for i in range(2, 70 + 1):
    if number[i - 1] >= 1:
        mask = prime_map[i]
        state = 1
        new_number_dic = number_dic.copy()
        for key, value in list(new_number_dic.items()):
            new_key = key ^ mask
            if new_key in number_dic:
                number_dic[new_key] += value
            else:
                number_dic[new_key] = value
            number_dic[new_key] %= module
        sum_time += (number[i - 1] - 1)

result = number_dic[0]

for j in range(number[0] + sum_time):
    result *= 2
    result %= module
print(result-1)


from collections import defaultdict
            #from collections import defaultdict
def getmask(x):
    ans = 0
    for i in range(2, x + 1):
        while x % i == 0:
            x //= i
            ans ^= 1 << i
    return ans
 
def main():
    maxn = 71
    #maxn = 71
    n = int(input())
    #n = int(input())
    a = [int(i) for i in input().split()]
    cnt = [0] * maxn
    for i in a:
        cnt[i] += 1
    masks = defaultdict(int)
    for i in range(1, maxn):
        masks[getmask(i)] += cnt[i]
    while masks[0] != sum(masks.values()):
        fixed = max(i for i in masks if masks[i])
        masks[0] -= 1
        for i in list(masks.keys()):
            if i ^ fixed < i:
                masks[i ^ fixed] += masks[i]
                masks[i] = 0
    print(pow(2, masks[0], 10**9+7) - 1)
    
    
    
main()