#!/usr/bin/env python
#-*- coding:utf-8 -*-


def selectionSort(arr, N): 
    counter = 0 
    for i in range(N):
        minj = i 
        for j in range(i,N):
            if arr[minj] > arr[j]:
                minj = j 
        if minj != i: counter += 1
        arr[i], arr[minj] = arr[minj],arr[i]

    return counter,arr

def main():

    N = int(raw_input())
    A = map(int, raw_input().split())
    
    counter,sortedA = selectionSort(A, N)
    print ' '.join(map(str,sortedA))
    print counter

#def test():

if __name__ == '__main__':
    main() def selectionSort(arr, N): 
    counter = 0 
    for i in range(N):
        minj = i 
        for j in range(i,N):
            if arr[minj] > arr[j]:
                minj = j 
        if minj != i: counter += 1
        arr[i], arr[minj] = arr[minj],arr[i]

    return counter,arr selectionSort counter = 0 counter 0 for i in range(N):
        minj = i 
        for j in range(i,N):
            if arr[minj] > arr[j]:
                minj = j 
        if minj != i: counter += 1
        arr[i], arr[minj] = arr[minj],arr[i]

     i range(N) range N minj = i minj i for j in range(i,N):
            if arr[minj] > arr[j]:
                minj = j 
         j range(i,N) range i N if arr[minj] > arr[j]:
                minj = j 
         arr[minj] > arr[j] arr[minj] arr minj arr[j] arr j minj = j minj j if minj != i: counter += 1
         minj != i minj i arr[i], arr[minj] = arr[minj],arr[i] arr[i] arr i arr[minj] arr minj arr[minj] arr minj arr[i] arr i return counter,arr return counter,arr counter arr arr arr N N def main():

    N = int(raw_input())
    A = map(int, raw_input().split())
    
    counter,sortedA = selectionSort(A, N)
    print ' '.join(map(str,sortedA))
    print counter

#def test(): main N = int(raw_input()) N int(raw_input()) int raw_input() raw_input A = map(int, raw_input().split()) A map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split counter,sortedA = selectionSort(A, N) counter selectionSort(A, N) selectionSort A N sortedA print ' '.join(map(str,sortedA)) ' '.join ' ' join map(str,sortedA) map str sortedA print if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():

    N = int(raw_input())
    A = map(int, raw_input().split())
    
    counter,sortedA = selectionSort(A, N)
    print ' '.join(map(str,sortedA))
    print counter

#def test(): def main():

    N = int(raw_input())
    A = map(int, raw_input().split())
    
    counter,sortedA = selectionSort(A, N)
    print ' '.join(map(str,sortedA))
    print counter

#def test(): main def selectionSort(arr, N): 
    counter = 0 
    for i in range(N):
        minj = i 
        for j in range(i,N):
            if arr[minj] > arr[j]:
                minj = j 
        if minj != i: counter += 1
        arr[i], arr[minj] = arr[minj],arr[i]

    return counter,arr def selectionSort(arr, N): 
    counter = 0 
    for i in range(N):
        minj = i 
        for j in range(i,N):
            if arr[minj] > arr[j]:
                minj = j 
        if minj != i: counter += 1
        arr[i], arr[minj] = arr[minj],arr[i]

    return counter,arr selectionSort
#!/usr/bin/env python
#-*- coding:utf-8 -*-


def selectionSort(arr, N): 
    counter = 0 
    for i in range(N):
        minj = i 
        for j in range(i,N):
            if arr[minj] > arr[j]:
                minj = j 
        if minj != i: counter += 1
        arr[i], arr[minj] = arr[minj],arr[i]

    return counter,arr

def main():

    N = int(raw_input())
    A = map(int, raw_input().split())
    
    counter,sortedA = selectionSort(A, N)
    print ' '.join(map(str,sortedA))
    print counter

#def test():

if __name__ == '__main__':
    main()