def selection_sort(N, a):
    c = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
    return a, c

ans, cnt = selection_sort(int(input()), [int(s) for s in input().split()])
print(' '.join(str(s) for s in ans), cnt, sep='\n') def selection_sort(N, a):
    c = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
    return a, c selection_sort c = 0 c 0 for i in range(N):
        minj = i
        for j in range(i, N):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
     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 i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
     i != minj i minj a[i], a[minj] = a[minj], a[i] a[i] a i a[minj] a minj a[minj] a minj a[i] a i c += 1 c 1 return a, c return a, c a c N N a a int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s ans, cnt = selection_sort(int(input()), [int(s) for s in input().split()]) ans selection_sort(int(input()), [int(s) for s in input().split()]) selection_sort int(input()) int input() input [int(s) for s in input().split()] cnt print(' '.join(str(s) for s in ans), cnt, sep='\n') print ' '.join(str(s) for s in ans) ' '.join ' ' join str(s) str s cnt sep='\n' sep '\n' def selection_sort(N, a):
    c = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
    return a, c def selection_sort(N, a):
    c = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
    return a, c selection_sort cnt = selection_sort(int(input()), [int(s) for s in input().split()]) selection_sort(int(input()), [int(s) for s in input().split()]) cnt ans, cnt = selection_sort(int(input()), [int(s) for s in input().split()]) selection_sort(int(input()), [int(s) for s in input().split()]) ans
def selection_sort(N, a):
    c = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
    return a, c

ans, cnt = selection_sort(int(input()), [int(s) for s in input().split()])
print(' '.join(str(s) for s in ans), cnt, sep='\n')