def calc(N, A):
    Z = 10 ** 9 + 7
    A.sort(key=lambda a: -a)
    B = [
        [1 if c == '0' else 0, 1 if c == '1' else 0]
        for c in list(bin(A[0])[2:])
    ]
    M = len(B)
    for a in A[1:]:
        b = bin(a)[2:]
        m = len(b)
        for i in range(M):
            c = int(b[i - M + m]) if i - M + m > -1 else 0
            B[i][c] += 1
    x = 0
    for p in B:
        x = x * 2 + p[0] * p[1]
        x = x % Z
    return x


N = int(input())
A = [int(s) for s in input().split()]
print(calc(N, A))