# N = int(input())
# A = [0] * N
# B = []
# for n in range(N):
#     A[n] = int(input())
#     bn = []
#     for i in range(A[n]):
#         x, y = map(int, input().split())
#         bn.append((x-1, y))
#     B.append(bn)

# ans = 0
# # bit & (1 << n) で n 番目の 0,1
# for bit in range(1 << N):
#     ok = [False] * N
#     for n in range(N):
#         if ((bit >> n) & 1) == 1:
#             if all([((bit >> B[n][i][0]) & 1) == B[n][i][1] for i in range(A[n])]):
#                 ok[n] = True
#         else:
#             if all([((bit >> B[n][i][0]) & 1) != B[n][i][1] for i in range(A[n])]):
#                 ok[n] = True
#     if all(ok):
#         ans = max(ans, sum(list(map(int, format(bit, "b")))))

# print(ans)

N = int(input())
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7

ans = 0
for i in range(60):
    n = sum([(a >> i) & 1 for a in A])
    ans = (ans + n * (N - n) * (2 ** i)) % MOD

print(ans)