mod = 10**9+7
n = int(input())
a = [int(x) for x in input().split()]
count = 0
for i in range(0,n):
	a[i] = bin(a[i])
 
for i in range(0,n-1):
    for j in range(i+1,n):
        count+=(int(a[i],2) ^ int(a[j],2))%mod
 
count = count%(mod)
print(count)