from itertools import combinations 

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = int(input())
A = LI()
mod = 10**9 + 7
ans = 0

for a in combinations(A, 2):
    ans += a[0] ^ a[1]
    ans %= mod

print(ans)