
    Design an algorithm for an event recommendation system that determines the number of possible balanced user interest profiles of length 2n, where a profile is considered balanced if the number of active interests in the first n categories equals the number of active interests in the last n categories. Each interest is represented as a binary value (1 for interested, 0 for not interested), and the system needs this count to optimize its matching capabilities.
    

    
def count_binary_seq(n):
    """
    Design an algorithm for an event recommendation system that determines the number of possible balanced user interest profiles of length 2n, where a profile is considered balanced if the number of active interests in the first n categories equals the number of active interests in the last n categories. Each interest is represented as a binary value (1 for interested, 0 for not interested), and the system needs this count to optimize its matching capabilities.
    

    """
def count_binary_seq(n):
    """
    Design an algorithm for an event recommendation system that determines the number of possible balanced user interest profiles of length 2n, where a profile is considered balanced if the number of active interests in the first n categories equals the number of active interests in the last n categories. Each interest is represented as a binary value (1 for interested, 0 for not interested), and the system needs this count to optimize its matching capabilities.
    

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