n=int(input())
A=list(map(int, input().split()))
from itertools import permutations, combinations,combinations_with_replacement,product
L = combinations(range(n), 2)   #nCr
cnt = 0
for i in L:
  cnt += (A[i[0]]^A[i[1]])%(10**9+7)
  cnt = cnt%(10**9+7)
print(cnt)