n = int(input())
a_list = list(map(int, input().split()))
# all_sum = 0
# for i in range(n):
#     for j in range(i+1, n):
#         # print("i:{}, j:{}, xor:{}".format(i, j, a_list[i] ^ a_list[j]))
#         mod_num = (a_list[i] ^ a_list[j]) % (10 ** 9 + 7)
#         all_sum += mod_num

# print(all_sum % (10 ** 9 + 7))

# 結果の数
result_num = 0

# 割る数
mod = 10 ** 9 + 7

# ある桁について考える
for i in range(1, 61):
    zero_count = 0
    one_count = 0
    for a in a_list:
        i_num = str(bin(a))[2:].zfill(60)[-1 * i]
        if int(i_num) == 0:
            zero_count += 1
        else:
            one_count += 1
    result_num += (2 ** (i-1)) % mod * (zero_count * one_count) % mod 
    result_num %= mod

print(result_num)
