#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
???????????????
?????????????????????????¨??????????????????§?????????????°????????????????????????????????????´???????????¢?????´???????????§??????

1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 0 ?????? N-1 ?????§
3     minj = i
4     for j ??? i ?????? N-1 ?????§
5       if A[j] < A[minj]
6         minj = j
7     A[i] ??¨ A[minj] ?????????

"""
import math

def swap(A, i, j):
    x = A[i]
    A[i] = A[j]
    A[j] = x

def sSort(A, N):
    cnt = 0
    for i in range(0, N-1):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            swap(A,i,minj)
            cnt += 1
    return cnt

# ?????????
N = int(input().strip())
A = list(map(int,input().strip().split()))
cnt = sSort(A,N)
print(" ".join(map(str,A)))
print(cnt) """
???????????????
?????????????????????????¨??????????????????§?????????????°????????????????????????????????????´???????????¢?????´???????????§??????

1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 0 ?????? N-1 ?????§
3     minj = i
4     for j ??? i ?????? N-1 ?????§
5       if A[j] < A[minj]
6         minj = j
7     A[i] ??¨ A[minj] ?????????

""" import math math def swap(A, i, j):
    x = A[i]
    A[i] = A[j]
    A[j] = x swap x = A[i] x A[i] A i A[i] = A[j] A[i] A i A[j] A j A[j] = x A[j] A j x A A i i j j def sSort(A, N):
    cnt = 0
    for i in range(0, N-1):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            swap(A,i,minj)
            cnt += 1
    return cnt

# ????????? sSort cnt = 0 cnt 0 for i in range(0, N-1):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            swap(A,i,minj)
            cnt += 1
     i range(0, N-1) range 0 N-1 N 1 minj = i minj i for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
         j range(i,N) range i N if A[j] < A[minj]:
                minj = j
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j if minj != i:
            swap(A,i,minj)
            cnt += 1
     minj != i minj i swap(A,i,minj) swap A i minj cnt += 1 cnt 1 return cnt cnt A A N N N = int(input().strip()) N int(input().strip()) int input().strip() ().strip () input strip A = list(map(int,input().strip().split())) A list(map(int,input().strip().split())) list map(int,input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split cnt = sSort(A,N) cnt sSort(A,N) sSort A N print(" ".join(map(str,A))) print " ".join(map(str,A)) " ".join " " join map(str,A) map str A print(cnt) print cnt cnt = sSort(A,N) sSort(A,N) cnt def sSort(A, N):
    cnt = 0
    for i in range(0, N-1):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            swap(A,i,minj)
            cnt += 1
    return cnt

# ????????? def sSort(A, N):
    cnt = 0
    for i in range(0, N-1):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            swap(A,i,minj)
            cnt += 1
    return cnt

# ????????? sSort N = int(input().strip()) int(input().strip()) N A = list(map(int,input().strip().split())) list(map(int,input().strip().split())) A def swap(A, i, j):
    x = A[i]
    A[i] = A[j]
    A[j] = x def swap(A, i, j):
    x = A[i]
    A[i] = A[j]
    A[j] = x swap
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
???????????????
?????????????????????????¨??????????????????§?????????????°????????????????????????????????????´???????????¢?????´???????????§??????

1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 0 ?????? N-1 ?????§
3     minj = i
4     for j ??? i ?????? N-1 ?????§
5       if A[j] < A[minj]
6         minj = j
7     A[i] ??¨ A[minj] ?????????

"""
import math

def swap(A, i, j):
    x = A[i]
    A[i] = A[j]
    A[j] = x

def sSort(A, N):
    cnt = 0
    for i in range(0, N-1):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            swap(A,i,minj)
            cnt += 1
    return cnt

# ?????????
N = int(input().strip())
A = list(map(int,input().strip().split()))
cnt = sSort(A,N)
print(" ".join(map(str,A)))
print(cnt)