'''
選択ソート
'''

n = int(input())
a = list(map(int,input().split()))

cnt = 0
for i in range(n):
    minj = i
    for j in range(i,n):
        if a[j] < a[minj]:
            minj = j
    if a[i] != a[minj]:
        cnt += 1
    tmp = a[i]
    a[i] = a[minj]
    a[minj] = tmp

print(' '.join(map(str,a)))
print(cnt)
 '''
選択ソート
''' 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 cnt = 0 cnt 0 for i in range(n):
    minj = i
    for j in range(i,n):
        if a[j] < a[minj]:
            minj = j
    if a[i] != a[minj]:
        cnt += 1
    tmp = a[i]
    a[i] = a[minj]
    a[minj] = tmp i range(n) range n 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 a[i] != a[minj]:
        cnt += 1
     a[i] != a[minj] a[i] a i a[minj] a minj cnt += 1 cnt 1 tmp = a[i] tmp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = tmp a[minj] a minj tmp print(' '.join(map(str,a))) print ' '.join(map(str,a)) ' '.join ' ' join map(str,a) map str a print(cnt) print cnt minj = j j minj cnt = 0 0 cnt tmp = a[i] a[i] tmp a = list(map(int,input().split())) list(map(int,input().split())) a n = int(input()) int(input()) n cnt += 1 1 cnt minj = i i minj
'''
選択ソート
'''

n = int(input())
a = list(map(int,input().split()))

cnt = 0
for i in range(n):
    minj = i
    for j in range(i,n):
        if a[j] < a[minj]:
            minj = j
    if a[i] != a[minj]:
        cnt += 1
    tmp = a[i]
    a[i] = a[minj]
    a[minj] = tmp

print(' '.join(map(str,a)))
print(cnt)

