N=int(input())
import itertools
L=list(map(int,input().split()))
CM = itertools.combinations(L, 2)
ANS = 0
MD = 10**9 + 7
for s in list(CM):
  ANS += (s[0] ^ s[1])

if ANS >= MD:
  print(ANS % MD)
else:
  print(ANS)