
    Write a function to calculate the total number of possible payment patterns over a 2n-month credit evaluation period, where a successful payment is marked as 1 and a missed payment as 0, such that the number of successful payments in the first n months equals the number of successful payments in the last n months. This payment stability metric helps assess a borrower's consistency in meeting financial obligations over time.
    

    
def count_binary_seq(n):
    """
    Write a function to calculate the total number of possible payment patterns over a 2n-month credit evaluation period, where a successful payment is marked as 1 and a missed payment as 0, such that the number of successful payments in the first n months equals the number of successful payments in the last n months. This payment stability metric helps assess a borrower's consistency in meeting financial obligations over time.
    

    """
def count_binary_seq(n):
    """
    Write a function to calculate the total number of possible payment patterns over a 2n-month credit evaluation period, where a successful payment is marked as 1 and a missed payment as 0, such that the number of successful payments in the first n months equals the number of successful payments in the last n months. This payment stability metric helps assess a borrower's consistency in meeting financial obligations over time.
    

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