N = int(input())
num_list = map(int, input().split())

max_bit_length = len(format(2**60-1, "b"))
one_list = [[] for i in range(max_bit_length)]
zero_list = [[]for i in range(max_bit_length)]
for i in num_list:
  num = i
  bit_num = format(num, "b")
  for j in range(1, len(bit_num)+1):
    check_num = int(bit_num[-j])
    if check_num:
      one_list[j-1].append(1)
    else:
      zero_list[j-1].append(1)
  for k in range(1, (max_bit_length-len(bit_num))+1):
    zero_list[-k].append(1)
ans = 0
radix = 1
for k,l in zip(one_list, zero_list):
  ans += radix*(len(k)*len(l))
  radix *= 2
print(ans%(10**9+7)) 