n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
m2 = [1 for i in range(60)]
for i in range(1,60):
    m2[i] = (m2[i-1]*2)%mod

n1 = [0 for i in range(60)]
for j in range(60):
    md = 1
    for i in range(n):
        n1[j] += (a[i]//md)%2
    md *= 2

'''
ans = 0
for i in range(n-1):
    for j in range(60):
        if al[i][j] == 0:
            ans = (ans+(sa[n-1][j]-sa[i][j])*m2[j])%mod
        else:
            ans = (ans+(n-1-i-sa[n-1][j]+sa[i][j])*m2[j])%mod

print(ans)
'''
