denominator = 1000000000 + 7

def prepare(a):
  a = int(a)
  a = a % denominator
  return a

N = int(input().rstrip())
l = list(map(int, input().rstrip().split(' ')))
#l = list(map(prepare, input().rstrip().split(' ')))

sum = 0
hash = {}

for i in range(N-1):
  for j in range(i+1, N):
    if l[i] < l[j]:
      x, y = l[i], l[j]
    else:
      x, y = l[j], l[i]
    
    if not str(x) + ':' + str(y) in hash:
      hash[str(x) + ':' + str(y)] = int(l[i] ^ l[j]) % denominator
      sum += (int(l[i] ^ l[j]) % denominator)
    else:
      sum += hash[str(x) + ':' + str(y)]
    #print('l[i]:' + str(l[i]) + ', l[j]: ' + str(l[j]) + ', l[i] ^ l[j]: ' + str(l[i] ^ l[j]))

print(sum % denominator)