def main():
    MOD = 10**9 + 7
    A_UB = 2**60  # upper bound
    MAX_BIN_LENGTH = len('{:b}'.format(A_UB))
    BIN_FORMAT = '{{:0{}b}}'.format(MAX_BIN_LENGTH)

    N = int(input())
    A = list(map(int, input().split(' ')))
    rev_bin_A = [BIN_FORMAT.format(a)[::-1] for a in A]

    bit_coef = [0 for _ in range(MAX_BIN_LENGTH)]
    for b in range(MAX_BIN_LENGTH):
        bit_list = [int(rev_bin_a[b]) for rev_bin_a in rev_bin_A]
        one_num = sum(bit_list)
        zero_num = N - one_num
        bit_coef[b] = one_num * zero_num

    answer = 0
    for b in range(MAX_BIN_LENGTH):
        pow_2 = (2**b) % MOD
        answer += (pow_2 * bit_coef[b]) % MOD
    answer %= MOD
    print(answer)


if __name__ == '__main__':
    main()