n = int(input())
a_ls = list(map(int, input().split()))

ret = 0

for i in range(60):
    cnt_0 = 0
    cnt_1 = 0
    for item in a_ls:
        if len(bin(item)) <= i:
            cnt_0 += 1
        elif bin(item)[-1-i] == '1':
            cnt_1 += 1
        else:
            cnt_0 += 1
    ret += cnt_1 * cnt_0 * (2 ** i)
    ret %= 10 ** 9 + 7

print(ret)
