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

ans = 0
 
MOD = (10**9+7)
for i in range(62):
    c = 0
    for ai in a:
        if ai&(1<<i): c += 1
    
    r = c*(n-c)
    ans += (1<<i)*r
    ans %= MOD
 
 
print(ans)