n = int(input())
a = list(map(int, input().split()))

t = 0
m = 7 + 10**9 
for i in range(n-1):
  for j in range(i+1,n):
    temp = 0
    temp = int(format(a[i], 'b')) + int(format(a[j], 'b'))
    temp_s = str(temp).replace('2', '0')
    t += int(temp_s, 2)
    t = t%m
print(t)    