import math
N = 10**9+7
n = int(input())
a = list(map(int,input().split()))

ans = 0

po = 1
for i in range(61):
    sum=0
    for j in range(n):
        sum+=(a[j]>>i) & 1
    ans+=sum*(n-sum)*po
    ans%=N
    po*=2
    po%=N
print(ans)
