N = int(input())
num_list = list(map(int, input().split()))
 
length = N
amount = 0
for i in range(length-1):
  for j in range(i+1, length):
    num1 = num_list[i]
    num2 = num_list[j]
    num = num1 ^ num2
    amount += num

print(amount % (10**9 + 7))