MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

ans = 0
twopow = 1
for n in range(60):
    one = sum( ((Ai >> n) & 1) for Ai in A )
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    twopow = twopow << 1 % MOD

print(ans)