def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9+7
    zero = [0] * 61
    one = [0] * 61
    for i in range(n):
        for j in range(61):
            if a[i]>>j  & 1:
                one[j] += 1
            else:
                zero[j] += 1
    ans = 0
    for i in range(60):
        ans += ((one[i]*zero[i]) * pow(2, i, mod)) % mod
        ans %= mod
    print(ans)
resolve()