def solve():
    MOD = 10**9 + 7

    N = int(input())
    As = list(map(int, input().split()))

    num1s = [0] * 60
    for A in As:
        for d in range(60):
            if (A>>d) & 1:
                num1s[d] += 1

    ans = 0
    for d in range(60):
        ans += num1s[d] * (N-num1s[d]) * pow(2, d, MOD)
        ans %= MOD

    print(ans)


solve()
