n = int(input())
a = list(map(int, input().split()))
c1_list = [0]*n
for i in range(n):
  b = format(a[i], '060b')
  for j in b:
    if j == "1":
      c1_list[j] += 1
count = 0
for i in range(n):
  count = (count + c1_list[i]*(n-c1_list[i])*2**(60-i)) % 1000000007
print(count)