import numpy as np
i8 = np.int64
i4 = np.int32
MOD = 1000000007

def main2():
    stdin = open('/dev/stdin')
    N = int(stdin.readline())
    m = 60
    x = np.zeros(m, i8)
    for d in map(int, stdin.readline().split()):
        for i in range(m):
            if d & 1:
                x[i] += 1
            d >>= 1
    ans = 0
    for i in range(m - 1, -1, -1):
        ans = (ans * 2 + x[i] * (N - x[i])) % MOD
    print(ans)

main2()