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

x = np.zeros((n, b), np.int)
for i in range(n):
    x[i] = np.array(list(bin(a[i])[2:].zfill(b)), int)

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

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

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