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]
    bit_num1 = format(num1, "b")
    bit_num2 = format(num2, "b")
    length_num1 = len(bit_num1)
    length_num2 = len(bit_num2)
    max_length = max(length_num1, length_num2)
    bit_num1 = bit_num1.zfill(max_length)
    bit_num2 = bit_num2.zfill(max_length)       
    num = ""
    for k in range(1, max_length+1):
      if int(bit_num1[-k]) and not int(bit_num2[-k]):
        num = "1" + num
      elif not int(bit_num1[-k]) and int(bit_num2[-k]):
        num = "1" + num
      else:
        num = "0" + num
    amount += int(num, 2)

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