import math
n = int(input())
a = list(map(int,input().split()))

ans = 0
for i in range(int(math.log2(max(a)))+2):
    sum=0
    for j in range(n):
        sum+=(a[j]>>i) & 1
    ans+=sum*(n-sum)*(2**i)
    ans%=10**9+7
print(ans)
