import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
A = [int(x) for x in readline().rstrip().split()]
B = [0] * 60
C = [[0] * 60 for _ in range(N)]
ans = 0
for i in range(N):
    i_bin = list(bin(A[i]))
    i_bin = i_bin[2:]
    i_bin = i_bin[::-1]
    k = 0
    for j in i_bin:
        if j == "1":
            C[i][k] += 1 
            B[k] += 1
        k += 1
B = np.array(B)
for p in range(N-1):
    temp = np.array(C[p])
    B -= temp
    for q in range(60):
        if temp[q] == 1:
            ans += (N - (p + 1) - B[q]) * 2 ** q
            ans %= 7 + 10 ** 9
        else:
            ans += B[q] * 2 ** q
            ans %= 7 + 10 ** 9
print(ans)    