
    Design a function that determines the number of possible traffic flow patterns over 2n time intervals, where each interval is marked as either high-traffic (1) or low-traffic (0), such that the total number of high-traffic intervals in the first n periods equals the total number of high-traffic intervals in the last n periods. This analysis helps identify balanced traffic patterns between two equal time segments for optimal traffic light scheduling.
    

    
def count_binary_seq(n):
    """
    Design a function that determines the number of possible traffic flow patterns over 2n time intervals, where each interval is marked as either high-traffic (1) or low-traffic (0), such that the total number of high-traffic intervals in the first n periods equals the total number of high-traffic intervals in the last n periods. This analysis helps identify balanced traffic patterns between two equal time segments for optimal traffic light scheduling.
    

    """
def count_binary_seq(n):
    """
    Design a function that determines the number of possible traffic flow patterns over 2n time intervals, where each interval is marked as either high-traffic (1) or low-traffic (0), such that the total number of high-traffic intervals in the first n periods equals the total number of high-traffic intervals in the last n periods. This analysis helps identify balanced traffic patterns between two equal time segments for optimal traffic light scheduling.
    

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