import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
S = 0
MOD = 1000000007

def xor(n):
    return n[0] ^ n[1]

import itertools
L = list(itertools.combinations(A, 2))
for i in L:
    S += xor(i)
      
print(S % MOD)