
    Design a fraud detection algorithm that analyzes transaction security patterns of length 2n, where n represents the pattern's half-length, to identify potentially suspicious activities by comparing the sum of historical transaction markers (first n bits) with current transaction markers (last n bits). The algorithm should determine how many possible valid security patterns exist where the sum of historical markers equals the sum of current transaction markers, helping establish baseline patterns for the fraud detection system.
    

    
def count_binary_seq(n):
    """
    Design a fraud detection algorithm that analyzes transaction security patterns of length 2n, where n represents the pattern's half-length, to identify potentially suspicious activities by comparing the sum of historical transaction markers (first n bits) with current transaction markers (last n bits). The algorithm should determine how many possible valid security patterns exist where the sum of historical markers equals the sum of current transaction markers, helping establish baseline patterns for the fraud detection system.
    

    """
def count_binary_seq(n):
    """
    Design a fraud detection algorithm that analyzes transaction security patterns of length 2n, where n represents the pattern's half-length, to identify potentially suspicious activities by comparing the sum of historical transaction markers (first n bits) with current transaction markers (last n bits). The algorithm should determine how many possible valid security patterns exist where the sum of historical markers equals the sum of current transaction markers, helping establish baseline patterns for the fraud detection system.
    

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