from itertools import combinations

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

total = 0
for pat in combinations(range(n), 2):
    total += a[pat[0]] ^ a[pat[1]]
print(total % (10**9 + 7))
