import numpy as np
n = int(input())
a = map(int, input().split())
p = 7 + 10**9
b = 60

x = np.array([tuple(map(int, bin(ai)[2:].zfill(b))) for ai in a])

s = np.count_nonzero(x, axis=0)

pow2 = (2 ** np.array(list(range(b)), np.int64))[::-1]

ans = s%p * (n-s)%p * (pow2%p)
print(np.sum(ans) % p)