package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func main() {

	// 繰り返し回数
	N, _ := strconv.Atoi(readLine())

	strWords := strings.Fields(readLine())

	arr := make([]int, 0)
	for _, strWord := range strWords {
		intWord, _ := strconv.Atoi(strWord)
		arr = append(arr, intWord)
	}

	changeNum := 0
	// n
	for n := 0; n < N - 1; {

		//fmt.Println(arr[n], "ターゲット", n)
		//fmt.Println(arr)
		//fmt.Println(range_f, "####", range_l)

		range_f := n
		range_l := N - 1

		min_k := range_f

		// 最終ラインまで
		for ; range_f != range_l; {

			// 最小値を更新する
			if arr[min_k] > arr[range_l] {
				min_k = range_l
			}
			range_l--
		}

		// 最小値とターゲットを交換
		if min_k != n {
			//fmt.Println(arr[n], " ==> ", arr[min_k])

			changeNum++

			temp := arr[n]
			arr[n] = arr[min_k]
			arr[min_k] = temp
		}
		//fmt.Println(arr)
		n++
	}

	fmt.Println(reduce(arr))
	fmt.Println(changeNum)

	return
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func reduce(intArray []int) string {
	reducedString := ""
	for _, inz := range intArray {
		reducedString += " " + strconv.FormatInt(int64(inz), 10)
	}
	return strings.Trim(reducedString, " ")
}

