def print_A():
    for i, n in enumerate(A):
        if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ')

N = int(input())
A = [int(n) for n in input().split()]
cnt = 0
flg = 0
for i in range(N):
    min_j = i
    for j in range(i, N):
        if A[j] < A[min_j]:
            min_j = j
            flg = 1
    if flg == 1:
        cnt += 1
        flg = 0
        w = A[i]; A[i] = A[min_j]; A[min_j] = w
print_A()
print(cnt)
 def print_A():
    for i, n in enumerate(A):
        if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ') print_A for i, n in enumerate(A):
        if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ') i n enumerate(A) enumerate A if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ') i == N - 1 i N - 1 N 1 print(A[i]) print A[i] A i print(A[i], end=' ') print A[i] A i end=' ' end ' ' N = int(input()) N int(input()) int input() input int(n) for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() int(n) int n A = [int(n) for n in input().split()] A [int(n) for n in input().split()] cnt = 0 cnt 0 flg = 0 flg 0 for i in range(N):
    min_j = i
    for j in range(i, N):
        if A[j] < A[min_j]:
            min_j = j
            flg = 1
    if flg == 1:
        cnt += 1
        flg = 0
        w = A[i]; A[i] = A[min_j]; A[min_j] = w i range(N) range N min_j = i min_j i for j in range(i, N):
        if A[j] < A[min_j]:
            min_j = j
            flg = 1
     j range(i, N) range i N if A[j] < A[min_j]:
            min_j = j
            flg = 1
     A[j] < A[min_j] A[j] A j A[min_j] A min_j min_j = j min_j j flg = 1 flg 1 if flg == 1:
        cnt += 1
        flg = 0
        w = A[i]; A[i] = A[min_j]; A[min_j] = w flg == 1 flg 1 cnt += 1 cnt 1 flg = 0 flg 0 w = A[i] w A[i] A i A[i] = A[min_j] A[i] A i A[min_j] A min_j A[min_j] = w A[min_j] A min_j w print_A() print_A print(cnt) print cnt flg = 0 0 flg min_j = i i min_j def print_A():
    for i, n in enumerate(A):
        if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ') def print_A():
    for i, n in enumerate(A):
        if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ') print_A N = int(input()) int(input()) N flg = 1 1 flg flg = 0 0 flg w = A[i] A[i] w cnt = 0 0 cnt min_j = j j min_j cnt += 1 1 cnt A = [int(n) for n in input().split()] [int(n) for n in input().split()] A
def print_A():
    for i, n in enumerate(A):
        if i == N - 1:
            print(A[i])
        else:
            print(A[i], end=' ')

N = int(input())
A = [int(n) for n in input().split()]
cnt = 0
flg = 0
for i in range(N):
    min_j = i
    for j in range(i, N):
        if A[j] < A[min_j]:
            min_j = j
            flg = 1
    if flg == 1:
        cnt += 1
        flg = 0
        w = A[i]; A[i] = A[min_j]; A[min_j] = w
print_A()
print(cnt)

