#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
stdin.readline()
data = [int(s) for s in stdin.readline().split()]
swap_times = 0
for i in range(len(data)):
    mini = i
    swap_flag = False
    for j in range(i, len(data)):
        if data[j] < data[mini]:
            mini = j
            swap_flag = True
    data[i], data[mini] = data[mini], data[i]
    swap_times += swap_flag
print(*data)
print(swap_times)