def count(edges, bit):
    if (comb[bit] is not None):
        return comb[bit]
    comb[bit] = 0
    for i in range(n):
        if (((bit >> i) & 1) and (not edges[i])):
            nxt_bit = (bit & (~ (1 << i)))
            nxt_edges = edges.copy()
            for j in range(n):
                nxt_edges[j] &= (~ (1 << i))
            cnt = count(nxt_edges, nxt_bit)
            comb[bit] += cnt
    return comb[bit]
def count(edges, bit):
    if (comb[bit] is not None):
        return comb[bit]
    comb[bit] = 0
    for i in range(n):
        if (((bit >> i) & 1) and (not edges[i])):
            nxt_bit = (bit & (~ (1 << i)))
            nxt_edges = edges.copy()
            for j in range(n):
                nxt_edges[j] &= (~ (1 << i))
            cnt = count(nxt_edges, nxt_bit)
            comb[bit] += cnt
    return comb[bit]