import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    vA = list(map(int, input().split()))
    MOD = 10**9 + 7
    BMAX = 61

    vC = [0,]*BMAX
    for a in vA:
        d = 0
        while a:
            vC[d] += a&1
            d += 1
            a >>= 1
    res = 0
    for i,c in enumerate(vC):
        x = pow(2,i) * c * (N-c) % MOD
        res = (res + x) % MOD
    print(res)


if __name__ == "__main__":
    main()
