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


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


if __name__ == '__main__':
    n = int(input())
    a = [int(n) for n in input().split()]
    ans, cnt = selection_sort(n, a)
    print(' '.join(map(str, ans)))
    print(cnt) def selection_sort(n, a):
    cnt = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[minj]
            a[minj] = a[i]
            a[i] = tmp
            cnt += 1
    return a, cnt selection_sort 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 i != minj:
            tmp = a[minj]
            a[minj] = a[i]
            a[i] = tmp
            cnt += 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:
            tmp = a[minj]
            a[minj] = a[i]
            a[i] = tmp
            cnt += 1
     i != minj i minj tmp = a[minj] tmp a[minj] a minj a[minj] = a[i] a[minj] a minj a[i] a i a[i] = tmp a[i] a i tmp cnt += 1 cnt 1 return a, cnt return a, cnt a cnt n n a a if __name__ == '__main__':
    n = int(input())
    a = [int(n) for n in input().split()]
    ans, cnt = selection_sort(n, a)
    print(' '.join(map(str, ans)))
    print(cnt) __name__ == '__main__' __name__ '__main__' 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()] ans, cnt = selection_sort(n, a) ans selection_sort(n, a) selection_sort n a cnt print(' '.join(map(str, ans))) print ' '.join(map(str, ans)) ' '.join ' ' join map(str, ans) map str ans print(cnt) print cnt def selection_sort(n, a):
    cnt = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[minj]
            a[minj] = a[i]
            a[i] = tmp
            cnt += 1
    return a, cnt def selection_sort(n, a):
    cnt = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[minj]
            a[minj] = a[i]
            a[i] = tmp
            cnt += 1
    return a, cnt selection_sort n = int(input()) int(input()) n cnt = selection_sort(n, a) selection_sort(n, a) cnt a = [int(n) for n in input().split()] [int(n) for n in input().split()] a ans, cnt = selection_sort(n, a) selection_sort(n, a) ans
# -*- coding: utf-8 -*-


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


if __name__ == '__main__':
    n = int(input())
    a = [int(n) for n in input().split()]
    ans, cnt = selection_sort(n, a)
    print(' '.join(map(str, ans)))
    print(cnt)