import numpy as np
n=int(input())
a=list(map(int,input().split()))
a=np.array(a)
suma=0
mod=10**9+7
for i in range(n):
  for j in range(i+1,n):
    tmp=np.bitwise_xor(a[i],a[j])%mod
    suma+=tmp
print(suma%mod)
