def xor(x,y):
  if x==y:
    return 0
  elif (x=1 and y=0) or (x=0 and y=1):
    return 1
  else:
    return 0
def XOR(x,y):
  X=str(bin(x))
  Y=str(bin(y))
  MA=max(len(X),len(Y))
  MI=min(len(X),len(Y))
  ans=[0 for i in range(MA)]
  if len(X)>len(Y):
    B=X
  else:
    B=Y
  i=1
  while i<=MA:
    if i<=MI:
      ans[MA-i]=xor(X[MA-i],Y[MA-i])
    else:
      ans[MA-i]=B[MA-i]
  ANS=str(1)
  for i in range(1,MA):
    ANS+=ans[i]
  ANS=int('ANS',2)
  return ANS
N=int(input())
A=list(map(int,input().split()))
c=0
for i in range(N-1):
  for p in range(i+1,N+1):
    c=(c+XOR(A[i],A[p]))%(10**9+7)
print(c)