N = int(input())
A = list(map(int, input().split()))
S = 0
MOD = 1000000007

import itertools
L = list(itertools.combinations(A, 2))
for i in range(len(L)):
    S += L[i][0] ^ L[i][1]
      
print(S % MOD)