def swap(l, i, j):
    tmp = l[i]
    l[i] = l[j]
    l[j] = tmp
    return l

def selection_sort(l):
    cnt = 0
    for i in range(len(l)):
        minj = i
        for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
        if i != minj:
            swap(l, i, minj)
            cnt += 1
    return l, cnt

if __name__ == '__main__':
    N = int(input())
    l = list(map(int, input().split()))

    sl, cnt = selection_sort(l)
    print(' '.join(map(str, sl)))
    print(cnt)
 def swap(l, i, j):
    tmp = l[i]
    l[i] = l[j]
    l[j] = tmp
    return l swap tmp = l[i] tmp l[i] l i l[i] = l[j] l[i] l i l[j] l j l[j] = tmp l[j] l j tmp return l l l l i i j j def selection_sort(l):
    cnt = 0
    for i in range(len(l)):
        minj = i
        for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
        if i != minj:
            swap(l, i, minj)
            cnt += 1
    return l, cnt selection_sort cnt = 0 cnt 0 for i in range(len(l)):
        minj = i
        for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
        if i != minj:
            swap(l, i, minj)
            cnt += 1
     i range(len(l)) range len(l) len l minj = i minj i for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
         j range(i + 1, len(l)) range i + 1 i 1 len(l) len l if l[j] < l[minj]:
                minj = j
         l[j] < l[minj] l[j] l j l[minj] l minj minj = j minj j if i != minj:
            swap(l, i, minj)
            cnt += 1
     i != minj i minj swap(l, i, minj) swap l i minj cnt += 1 cnt 1 return l, cnt return l, cnt l cnt l l if __name__ == '__main__':
    N = int(input())
    l = list(map(int, input().split()))

    sl, cnt = selection_sort(l)
    print(' '.join(map(str, sl)))
    print(cnt) __name__ == '__main__' __name__ '__main__' N = int(input()) N int(input()) int input() input l = list(map(int, input().split())) l list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sl, cnt = selection_sort(l) sl selection_sort(l) selection_sort l cnt print(' '.join(map(str, sl))) print ' '.join(map(str, sl)) ' '.join ' ' join map(str, sl) map str sl print(cnt) print cnt l = list(map(int, input().split())) list(map(int, input().split())) l sl, cnt = selection_sort(l) selection_sort(l) sl def selection_sort(l):
    cnt = 0
    for i in range(len(l)):
        minj = i
        for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
        if i != minj:
            swap(l, i, minj)
            cnt += 1
    return l, cnt def selection_sort(l):
    cnt = 0
    for i in range(len(l)):
        minj = i
        for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
        if i != minj:
            swap(l, i, minj)
            cnt += 1
    return l, cnt selection_sort N = int(input()) int(input()) N cnt = selection_sort(l) selection_sort(l) cnt def swap(l, i, j):
    tmp = l[i]
    l[i] = l[j]
    l[j] = tmp
    return l def swap(l, i, j):
    tmp = l[i]
    l[i] = l[j]
    l[j] = tmp
    return l swap
def swap(l, i, j):
    tmp = l[i]
    l[i] = l[j]
    l[j] = tmp
    return l

def selection_sort(l):
    cnt = 0
    for i in range(len(l)):
        minj = i
        for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
        if i != minj:
            swap(l, i, minj)
            cnt += 1
    return l, cnt

if __name__ == '__main__':
    N = int(input())
    l = list(map(int, input().split()))

    sl, cnt = selection_sort(l)
    print(' '.join(map(str, sl)))
    print(cnt)

