Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-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.

No tag edit access

G. Sum the Fibonacci

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given an array *s* of *n* non-negative integers.

A 5-tuple of integers (*a*, *b*, *c*, *d*, *e*) is said to be valid if it satisfies the following conditions:

- 1 ≤
*a*,*b*,*c*,*d*,*e*≤*n* - (
*s*_{a}|*s*_{b}) &*s*_{c}& (*s*_{d}^*s*_{e}) = 2^{i}for some integer*i* -
*s*_{a}&*s*_{b}= 0

Here, '|' is the bitwise OR, '&' is the bitwise AND and '^' is the bitwise XOR operation.

Find the sum of *f*(*s*_{a}|*s*_{b}) * *f*(*s*_{c}) * *f*(*s*_{d}^*s*_{e}) over all valid 5-tuples (*a*, *b*, *c*, *d*, *e*), where *f*(*i*) is the *i*-th Fibonnaci number (*f*(0) = 0, *f*(1) = 1, *f*(*i*) = *f*(*i* - 1) + *f*(*i* - 2)).

Since answer can be is huge output it modulo 10^{9} + 7.

Input

The first line of input contains an integer *n* (1 ≤ *n* ≤ 10^{6}).

The second line of input contains *n* integers *s*_{i} (0 ≤ *s*_{i} < 2^{17}).

Output

Output the sum as described above, modulo 10^{9} + 7

Examples

Input

2

1 2

Output

32

Input

3

7 4 1

Output

3520

Input

10

1 3 0 7 3 7 6 5 7 5

Output

1235424

Input

10

50 9 11 44 39 40 5 39 23 7

Output

113860062

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/28/2018 02:18:17 (d1).

Desktop version, switch to mobile version.

User lists

Name |
---|