
    In a personalized learning system, determine how many possible learning paths exist for a student studying 2n topics, where each topic is marked as either mastered (1) or not mastered (0), such that the number of topics mastered in the first n prerequisite subjects equals the number of topics mastered in the last n advanced subjects. The balanced mastery between prerequisite and advanced topics is essential for optimal learning progression.
    

    
def count_binary_seq(n):
    """
    In a personalized learning system, determine how many possible learning paths exist for a student studying 2n topics, where each topic is marked as either mastered (1) or not mastered (0), such that the number of topics mastered in the first n prerequisite subjects equals the number of topics mastered in the last n advanced subjects. The balanced mastery between prerequisite and advanced topics is essential for optimal learning progression.
    

    """
def count_binary_seq(n):
    """
    In a personalized learning system, determine how many possible learning paths exist for a student studying 2n topics, where each topic is marked as either mastered (1) or not mastered (0), such that the number of topics mastered in the first n prerequisite subjects equals the number of topics mastered in the last n advanced subjects. The balanced mastery between prerequisite and advanced topics is essential for optimal learning progression.
    

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