n = int(input())
a = list(map(int,input().split()))
a = list(map(lambda x: (str(bin(x))[2:]).zfill(60), a))
mod = 10**9 + 7
ans = 0
for i in range(60):
    cnt = 0
    for j in a:
        cnt += int(j[-1*(i+1)])
    ans += cnt * (n-cnt) * pow(2, i, mod) % mod
    ans %= mod
print(ans)
