def selection_sort(a,n):
    count=0
    for i in range(n):
        ch=False
        minj=i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
                ch = True
        if(ch):
            count+=1
        a[i],a[minj] = a[minj],a[i]
    return count

if __name__ == "__main__":
    n=int(input())
    a=list(map(int,input().split()))
    count=selection_sort(a,n)
    print(*a)
    print(count) def selection_sort(a,n):
    count=0
    for i in range(n):
        ch=False
        minj=i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
                ch = True
        if(ch):
            count+=1
        a[i],a[minj] = a[minj],a[i]
    return count selection_sort count=0 count 0 for i in range(n):
        ch=False
        minj=i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
                ch = True
        if(ch):
            count+=1
        a[i],a[minj] = a[minj],a[i]
     i range(n) range n ch=False ch False minj=i minj i for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
                ch = True
         j range(i,n) range i n if a[j] < a[minj]:
                minj = j
                ch = True
         a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j ch = True ch True if(ch):
            count+=1
         ch count+=1 count 1 a[i],a[minj] = a[minj],a[i] a[i] a i a[minj] a minj a[minj] a minj a[i] a i return count count a a n n if __name__ == "__main__":
    n=int(input())
    a=list(map(int,input().split()))
    count=selection_sort(a,n)
    print(*a)
    print(count) __name__ == "__main__" __name__ "__main__" n=int(input()) n int(input()) int input() input a=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split count=selection_sort(a,n) count selection_sort(a,n) selection_sort a n print(*a) print *a a print(count) print count count=selection_sort(a,n) selection_sort(a,n) count def selection_sort(a,n):
    count=0
    for i in range(n):
        ch=False
        minj=i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
                ch = True
        if(ch):
            count+=1
        a[i],a[minj] = a[minj],a[i]
    return count def selection_sort(a,n):
    count=0
    for i in range(n):
        ch=False
        minj=i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
                ch = True
        if(ch):
            count+=1
        a[i],a[minj] = a[minj],a[i]
    return count selection_sort n=int(input()) int(input()) n a=list(map(int,input().split())) list(map(int,input().split())) a
def selection_sort(a,n):
    count=0
    for i in range(n):
        ch=False
        minj=i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
                ch = True
        if(ch):
            count+=1
        a[i],a[minj] = a[minj],a[i]
    return count

if __name__ == "__main__":
    n=int(input())
    a=list(map(int,input().split()))
    count=selection_sort(a,n)
    print(*a)
    print(count)
