MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
s = 0
m = 1
for i in range(60):
    c = 0
    for j in range(n):
        c += a[j] & m
    c //= m
    s = (s + m*c*(n-c))%MOD
    m <<= 1
print(s)