import numpy as np
mod = 10**9+7
n = int(input())
a = [int(x) for x in input().split()]
a = np.array(a)
count = 0


for i in range(0,n-1):
    for j in range(i+1,n):
        count+=(a[i] ^ a[j])%mod

count = count%(mod)
print(count)