from functools import reduce

words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

y = [0]*60
for x in xs:
    for i in range(60):
        if x == 0:
            continue
        y[i] += x & 1
        x = x >> 1

ans = 0
for i,yi in enumerate(y):
    ans += 2**(i) * yi * (n-yi)
    ans %= 10**9 + 7
print(ans)
