def count_binary_seq(n):
    from math import comb
    # For each k from 0 to n, count sequences where first n bits sum to k
    # and last n bits sum to k: C(n,k) * C(n,k)
    return sum(comb(n, k) ** 2 for k in range(n + 1))