def run():
  b = 10**9+7
  N = int(input())
  a_li = list(map(int, input().split()))
  ans = 0
  for i in range(N-1):
    for j in range(i+1, N):
      ans += a_li[i]^a_li[j]
  print(ans%b)

if __name__ == '__main__':
  run()