#!/usr/bin/env python3
MOD = 1000000007
n, *a = map(int, open(0).read().split())
ans = 0
for i in range(61):
    zero = one = 0
    for x in a:
        if (x>>i)&1: one += 1
        else: zero += 1
    ans += pow(2, i, MOD) * zero * one % MOD
    ans %= MOD
print(ans)
