
    Given traffic density data for 2n consecutive time segments during peak delivery hours (where 1 represents high traffic and 0 represents low traffic), determine how many possible traffic patterns exist where the number of high-traffic segments in the first n time slots equals the number of high-traffic segments in the last n time slots. This analysis helps in identifying balanced delivery schedules where morning and afternoon shifts experience similar traffic conditions.
    

    
def count_binary_seq(n):
    """
    Given traffic density data for 2n consecutive time segments during peak delivery hours (where 1 represents high traffic and 0 represents low traffic), determine how many possible traffic patterns exist where the number of high-traffic segments in the first n time slots equals the number of high-traffic segments in the last n time slots. This analysis helps in identifying balanced delivery schedules where morning and afternoon shifts experience similar traffic conditions.
    

    """
def count_binary_seq(n):
    """
    Given traffic density data for 2n consecutive time segments during peak delivery hours (where 1 represents high traffic and 0 represents low traffic), determine how many possible traffic patterns exist where the number of high-traffic segments in the first n time slots equals the number of high-traffic segments in the last n time slots. This analysis helps in identifying balanced delivery schedules where morning and afternoon shifts experience similar traffic conditions.
    

    """
    nCr = 1
    res = 1
    for r in range(1, n + 1):
        nCr = nCr * (n + 1 - r) / r
        res += nCr * nCr
    return res