# -*- coding: utf-8 -*-


N = input()
A = list(map(int, input().split()))

sum = 0
for i in range((N-1)-1):
  for j in range(i+1, (N-1)):
    sum += (A[i]^A[j])

dst = sum % (10**9+7)
print(dst)
    
    
