def print_all_solutions_helper(board):
    """Display a chessboard for each possible configuration of filling the given
    board with queens and return the number of such configurations."""
    size = board.get_size()

    # if board is full, display solution
    if size == board.get_queens_count():
        board.display()
        print()
        return 1

    number_of_solutions = 0
    # place queen in next row
    for column in range(size):
        if board.is_this_column_safe_in_next_row(column):
            board.place_in_next_row(column)
            number_of_solutions += print_all_solutions_helper(board)
            board.remove_in_current_row()

    return number_of_solutions