n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        for k in range(max(len(bin(a[i]))-2,len(bin(a[j]))-2)):
            if a[i]>>k&1 != a[j]>>k&1:
                ans += 2**k%mod
print(ans%mod)