import math
MOD = 10**9 + 7
def cc(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] = format(a[i], '060b')
s = 0
for i in range(60):
    c0 = 0
    c1 = 0
    for j in range(n):
        if a[j][i] == '0':
            c0 += 1
        else:
            c1 += 1
    s += 2**(59-i)*c0*c1%MOD
    s %= MOD
print(s)