# coding: utf-8
# Here your code !
S = int(input())
N = list(map(int,input().split(" ")))


def seleSort(n,s):
    c =0
    for i in range(s):
        minj = i
        for j in range(i+1,s):
            if n[j]<n[minj]:
                minj = j
                
        n[i],n[minj]=n[minj],n[i]
        if i!= minj:
            c+=1
    print(" ".join(list(map(str,n))))
    print(c)
        
        
seleSort(N,S) S = int(input()) S int(input()) int input() input N = list(map(int,input().split(" "))) N list(map(int,input().split(" "))) list map(int,input().split(" ")) map int input().split(" ") ().split () input split " " def seleSort(n,s):
    c =0
    for i in range(s):
        minj = i
        for j in range(i+1,s):
            if n[j]<n[minj]:
                minj = j
                
        n[i],n[minj]=n[minj],n[i]
        if i!= minj:
            c+=1
    print(" ".join(list(map(str,n))))
    print(c)
        
         seleSort c =0 c 0 for i in range(s):
        minj = i
        for j in range(i+1,s):
            if n[j]<n[minj]:
                minj = j
                
        n[i],n[minj]=n[minj],n[i]
        if i!= minj:
            c+=1
     i range(s) range s minj = i minj i for j in range(i+1,s):
            if n[j]<n[minj]:
                minj = j
                
         j range(i+1,s) range i+1 i 1 s if n[j]<n[minj]:
                minj = j
                
         n[j]<n[minj] n[j] n j n[minj] n minj minj = j minj j n[i],n[minj]=n[minj],n[i] n[i] n i n[minj] n minj n[minj] n minj n[i] n i if i!= minj:
            c+=1
     i!= minj i minj c+=1 c 1 print(" ".join(list(map(str,n)))) print " ".join(list(map(str,n))) " ".join " " join list(map(str,n)) list map(str,n) map str n print(c) print c n n s s seleSort(N,S) seleSort N S N = list(map(int,input().split(" "))) list(map(int,input().split(" "))) N def seleSort(n,s):
    c =0
    for i in range(s):
        minj = i
        for j in range(i+1,s):
            if n[j]<n[minj]:
                minj = j
                
        n[i],n[minj]=n[minj],n[i]
        if i!= minj:
            c+=1
    print(" ".join(list(map(str,n))))
    print(c)
        
         def seleSort(n,s):
    c =0
    for i in range(s):
        minj = i
        for j in range(i+1,s):
            if n[j]<n[minj]:
                minj = j
                
        n[i],n[minj]=n[minj],n[i]
        if i!= minj:
            c+=1
    print(" ".join(list(map(str,n))))
    print(c)
        
         seleSort S = int(input()) int(input()) S
# coding: utf-8
# Here your code !
S = int(input())
N = list(map(int,input().split(" ")))


def seleSort(n,s):
    c =0
    for i in range(s):
        minj = i
        for j in range(i+1,s):
            if n[j]<n[minj]:
                minj = j
                
        n[i],n[minj]=n[minj],n[i]
        if i!= minj:
            c+=1
    print(" ".join(list(map(str,n))))
    print(c)
        
        
seleSort(N,S)