# -*- coding: utf-8 -*-

import sys
import os
import math


N = int(input())
A = list(map(int, input().split()))


def selection_sort(A):
    swap_num = 0
    for i in range(N):
        min_i = i
        for j in range(i + 1, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            swap_num += 1
    print(*A)
    print(swap_num)

selection_sort(A) import sys sys import os os import math math N = int(input()) N int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def selection_sort(A):
    swap_num = 0
    for i in range(N):
        min_i = i
        for j in range(i + 1, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            swap_num += 1
    print(*A)
    print(swap_num) selection_sort swap_num = 0 swap_num 0 for i in range(N):
        min_i = i
        for j in range(i + 1, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            swap_num += 1
     i range(N) range N min_i = i min_i i for j in range(i + 1, N):
            if A[j] < A[min_i]:
                min_i = j
         j range(i + 1, N) range i + 1 i 1 N if A[j] < A[min_i]:
                min_i = j
         A[j] < A[min_i] A[j] A j A[min_i] A min_i min_i = j min_i j if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            swap_num += 1
     i != min_i i min_i A[i], A[min_i] = A[min_i], A[i] A[i] A i A[min_i] A min_i A[min_i] A min_i A[i] A i swap_num += 1 swap_num 1 print(*A) print *A A print(swap_num) print swap_num A A selection_sort(A) selection_sort A N = int(input()) int(input()) N def selection_sort(A):
    swap_num = 0
    for i in range(N):
        min_i = i
        for j in range(i + 1, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            swap_num += 1
    print(*A)
    print(swap_num) def selection_sort(A):
    swap_num = 0
    for i in range(N):
        min_i = i
        for j in range(i + 1, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            swap_num += 1
    print(*A)
    print(swap_num) selection_sort A = list(map(int, input().split())) list(map(int, input().split())) A
# -*- coding: utf-8 -*-

import sys
import os
import math


N = int(input())
A = list(map(int, input().split()))


def selection_sort(A):
    swap_num = 0
    for i in range(N):
        min_i = i
        for j in range(i + 1, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            swap_num += 1
    print(*A)
    print(swap_num)

selection_sort(A)