import sys
input = sys.stdin.readline

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