n = int(input())
a = list(map(int,input().split()))
d = {}
for i in a:
  if i in d:
    d[i] += 1
  else:
    d[i] = 1
a = []
s = 0
for i in d:
  a.append((i, d[i]))
n = len(a)
for i in range(n -1):
  for j in range(i + 1, n):
    s += ((a[i][0] ^ a[j][0]) * (a[i][1] *a[j][1])) % 1000000007