n = int(input())
a = list(map(int,input().split()))
a_2 = []
for i in range(n):
  a_2.append(int(format(a[i],'b')))
total = 0
for i in range(n):
  for j in range(n):
    if i != j:
      t = str(a_2[i] + a_2[j])
      t_10 = int(t.replace('2','0'), 2)
      total += t_10
print((total/2) % (10**9+7))
      
      
