import itertools

n = int(input())
l = list(map(int,input().split()))
ans = 0

comb = list(itertools.combinations(l,2))

for i in range(len(comb)):
    k = int(bin(comb[i][0] ^ comb[i][1]),0)
    ans += k
    ans %= 10**9+7

print(ans)