def main():
  n=int(input())
  a=tuple(map(int,input().split()))
  mod=pow(10,9)+7
  ans=0
  for i in range(n-1):
    for j in range(i+1,n):
      ans=(ans+(a[i]^a[j])%mod)%mod
  print(ans)
if __name__=='__main__':
  main()