# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
mod = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
a = np.array(a)
ans = 0
# for bin_a in map(bin, a):
d = 1
num_of_one_per_keta = []
while d < (1 << 61):
    cnt = np.count_nonzero(a & d)
    num_of_one_per_keta.append(cnt)
    # ans += (N - cnt) * cnt * d
    # ans %= MOD
    d <<= 1
print(num_of_one_per_keta)
ans = 0
for i, num_of_one in enumerate(num_of_one_per_keta):
    ans += (n-num_of_one)*num_of_one*pow(2, i, mod) % mod
print(ans % mod)
