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

ans = 0

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