#!/usr/bin/env python3

MOD = 1000000007
n, *a = map(int, open(0).read().split())

ans = 0
w = 1
for i in range(61):
    zero = one = 0
    for x in a:
        if (x>>i)&1: one += 1
        else: zero += 1
    ans = (ans + w * zero * one % MOD) % MOD
    w = w * 2 % MOD
print(ans)
