
    Design an algorithm for an adaptive learning system that calculates the number of possible student response patterns of length 2n questions, where students must achieve the same number of correct answers in the first n questions as in the last n questions. Each question response is binary (correct/incorrect), and the system uses this to evaluate consistent performance across the assessment.
    

    
def count_binary_seq(n):
    """
    Design an algorithm for an adaptive learning system that calculates the number of possible student response patterns of length 2n questions, where students must achieve the same number of correct answers in the first n questions as in the last n questions. Each question response is binary (correct/incorrect), and the system uses this to evaluate consistent performance across the assessment.
    

    """
def count_binary_seq(n):
    """
    Design an algorithm for an adaptive learning system that calculates the number of possible student response patterns of length 2n questions, where students must achieve the same number of correct answers in the first n questions as in the last n questions. Each question response is binary (correct/incorrect), and the system uses this to evaluate consistent performance across the assessment.
    

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