import sys
input = sys.stdin.readline

n = int(input())
alist = list(map(int,input().split()))
anslist = list(alist[i]^alist[j] for i in range(n) for j in range(i+1,n))
s = sum(anslist)
if s < 10**9+7:
  print(s)
else:
  print(s%(10**9+7))
    
