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

ans = 0

a1 = max(a)
if a1 == 0:
    a1=2
ma = int(math.log2(a1))
if ma<0:
    ma=0
for i in range(ma+2):
    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)
