def xor_sum(a):
    sum = 0
    d = 10**9+7
    for i in range(60):
        n_0 = 0
        n_1 = 0
        for j in a:
            if str(format(j, 'b')).zfill(60)[i] == '0':
                n_0 += 1
            else:
                n_1 += 1
        sum += (pow(2, 59-i)*(n_0*n_1))%d
    print(sum%d)

n = int(input())
a = [int(i) for i in input().split()]

xor_sum(a)