n = int(input())
a_list = list(map(int, input().split()))
ans = 0
for i in range(61):
    k = 0
    for a in a_list:
        if a & 2 ** i != 0:
            k += 1
    ans += k * (n - k) * 2 ** i
print(ans % (10 ** 9 + 7))
