n = int(input())
a = list(map(lambda x:format(int(x), '060b') , input().split()))
n1 = [0]*60
for i in a:
  for j in range(60):
    if i[59-j]=='1':
      n1[j] += 1
over = 0
for i in range(60):
  tmp = n1[i]*(n-n1[i])+over
  n1[i] = tmp%2
  over = tmp//2
bin_str = ''
for i in n1[::-1]:
  bin_str += str(i)
print(int(bin_str, 2)%(10**9+7))