n = int(input())
ais = [int(i) for i in input().split()]
m = 10**9 + 7

total = 0
for i in range(n) :
  for j in range(i+1,n) :
    total += ais[i]^ais[j]
    if 100000 < total : total = total % m
    
print(total)