def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    mod = 10**9 + 7
    b = [0] * 60
    for ai in a:
        for k in range(ai.bit_length()):
            b[k] += ai & 1
            ai //= 2
    c = 0
    for k in range(60):
        c = (c + b[k] * (n - b[k]) * pow(2, k, mod)) % mod
    print(c)

if __name__ == '__main__':
    main()