import itertools

n = int(input())
b = list(map(int, input().split()))

b_pairs = []
for i in range(2, n+1):
    b_pairs += list(itertools.combinations(b, i))
    # 単に b_pairs += itertools.combinations(b, i) でも可

lis = []
for i in range(len(b_pairs)):
    if len(b_pairs[i]) == 2:
        lis.append(b_pairs[i])

z = []
for i in lis:
    x1, x2 = i[0], i[1]
    x = x1 ^ x2
    z.append(x)

z = sum(z)
x = z % (10**9 + 7)
print(x)