import itertools
n = int(input())
a = list(map(int, input().split()))

sums = 0
k = {}
for x in itertools.combinations(a, 2):
    if ((x[0], x[1]) in k.values()):
        sums += k[x[0], x[1]]
    else:
        r =int(bin(x[0] ^ x[1]), 2)
        k.setdefault((x[0], x[1]), r)
        sums += r

print(sums % (10**9 + 7))