n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7
ans = 0
for i in range(n):
    for j in range(i+1):
        #print(a[i] ^ a[j])
        ans += a[i] ^ a[j]
        ans %= MOD

print(ans)