input_num = int(input())
N = list(map(int,input().rstrip().split()))
ans = 0
for i in range(60):
  bit_1 = 0
  bit_0 = 0
  for i2 in range(input_num):
    if N[i2] % (2 ** i) == 0:
      bit_0 += 1
    else:
      N[i2] -= (2 ** (i - 1))
      bit_1 += 1
  ans += bit_0 * bit_1 * (2 ** (i - 1))
print(int(ans % ((10 ** 9) + 7)))