K = 1000000009
N = int(input())
A = [int(a) for a in input().split()]
li = [0] * 60
for n in range(N):
    for i in range(60):
        li[i] += A[n] >> i & 1
ans = 0
for i in range(60):
    ans += (1 << i) * li[i] * (N - li[i])
    ans %= K
print(ans)