Add N Queens problem counting algorithm