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

def xor(p, q):
  bp = format(p, '060b')
  bq = format(q, '060b')
  r = ""
  for i in range(60):
    if bp[i] != bq[i]:
      r += "1"
    else:
      r += "0"
  #nr = int(r)
  rr = int(r, 2)
  return rr
  
for i in range(n-1):
  for j in range(n-i-1):
    # a[i] XOR a[j]をtotalに足す。
    total += xor(a[i], a[i + j + 1])
    
print(total % (10 ** 9 + 7))