
    Design a fraud detection algorithm that analyzes transaction patterns over two consecutive time periods, where each period contains n indicators marking suspicious (1) or normal (0) activity flags. The algorithm must identify how many possible pattern combinations exist where the total number of suspicious flags in the first period equals the total in the second period, helping detect systematic fraudulent behavior patterns.
    

    
def count_binary_seq(n):
    """
    Design a fraud detection algorithm that analyzes transaction patterns over two consecutive time periods, where each period contains n indicators marking suspicious (1) or normal (0) activity flags. The algorithm must identify how many possible pattern combinations exist where the total number of suspicious flags in the first period equals the total in the second period, helping detect systematic fraudulent behavior patterns.
    

    """
def count_binary_seq(n):
    """
    Design a fraud detection algorithm that analyzes transaction patterns over two consecutive time periods, where each period contains n indicators marking suspicious (1) or normal (0) activity flags. The algorithm must identify how many possible pattern combinations exist where the total number of suspicious flags in the first period equals the total in the second period, helping detect systematic fraudulent behavior patterns.
    

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