N = int(input().rstrip())
l = list(map(int, input().rstrip().split(' ')))
denominator = 1000000000 + 7
sum = 0

for i in range(N-1):
  for j in range(i+1, N):
    sum += (int(l[i] ^ l[j]) % denominator)
    #print('l[i]:' + str(l[i]) + ', l[j]: ' + str(l[j]) + ', l[i] ^ l[j]: ' + str(l[i] ^ l[j]))

print(sum % denominator)