n = int(input())
*A, = map(int, input().split())
p = 10**9+7
A = [list(format(a, '060b'))[::-1] for a in A]
A = [[int(a[i]) for a in A] for i in range(60)]
s = 0
for i in range(60):
    Ai = A[i]
    c0 = Ai.count(0)
    c1 = Ai.count(1)
    c = c0*c1
    s = (s+c*(2**i)) % p
print(s)
