n = int(input())
nums=list(input().split())
    


def selectionSort(nums):
    count=0
    for i in range(len(nums)):
        minj=i
        for j in range(i,len(nums)):
            if int(nums[j])<int(nums[minj]):
                minj=j
        if i!=minj:          
            tmp=nums[minj]
            nums[minj]=nums[i]
            nums[i]=tmp
            count+=1
    print(' '.join(nums))
    print(count)


selectionSort(nums)
 n = int(input()) n int(input()) int input() input nums=list(input().split()) nums list(input().split()) list input().split() ().split () input split def selectionSort(nums):
    count=0
    for i in range(len(nums)):
        minj=i
        for j in range(i,len(nums)):
            if int(nums[j])<int(nums[minj]):
                minj=j
        if i!=minj:          
            tmp=nums[minj]
            nums[minj]=nums[i]
            nums[i]=tmp
            count+=1
    print(' '.join(nums))
    print(count) selectionSort count=0 count 0 for i in range(len(nums)):
        minj=i
        for j in range(i,len(nums)):
            if int(nums[j])<int(nums[minj]):
                minj=j
        if i!=minj:          
            tmp=nums[minj]
            nums[minj]=nums[i]
            nums[i]=tmp
            count+=1
     i range(len(nums)) range len(nums) len nums minj=i minj i for j in range(i,len(nums)):
            if int(nums[j])<int(nums[minj]):
                minj=j
         j range(i,len(nums)) range i len(nums) len nums if int(nums[j])<int(nums[minj]):
                minj=j
         int(nums[j])<int(nums[minj]) int(nums[j]) int nums[j] nums j int(nums[minj]) int nums[minj] nums minj minj=j minj j if i!=minj:          
            tmp=nums[minj]
            nums[minj]=nums[i]
            nums[i]=tmp
            count+=1
     i!=minj i minj tmp=nums[minj] tmp nums[minj] nums minj nums[minj]=nums[i] nums[minj] nums minj nums[i] nums i nums[i]=tmp nums[i] nums i tmp count+=1 count 1 print(' '.join(nums)) print ' '.join(nums) ' '.join ' ' join nums print(count) print count nums nums selectionSort(nums) selectionSort nums n = int(input()) int(input()) n nums=list(input().split()) list(input().split()) nums def selectionSort(nums):
    count=0
    for i in range(len(nums)):
        minj=i
        for j in range(i,len(nums)):
            if int(nums[j])<int(nums[minj]):
                minj=j
        if i!=minj:          
            tmp=nums[minj]
            nums[minj]=nums[i]
            nums[i]=tmp
            count+=1
    print(' '.join(nums))
    print(count) def selectionSort(nums):
    count=0
    for i in range(len(nums)):
        minj=i
        for j in range(i,len(nums)):
            if int(nums[j])<int(nums[minj]):
                minj=j
        if i!=minj:          
            tmp=nums[minj]
            nums[minj]=nums[i]
            nums[i]=tmp
            count+=1
    print(' '.join(nums))
    print(count) selectionSort
n = int(input())
nums=list(input().split())
    


def selectionSort(nums):
    count=0
    for i in range(len(nums)):
        minj=i
        for j in range(i,len(nums)):
            if int(nums[j])<int(nums[minj]):
                minj=j
        if i!=minj:          
            tmp=nums[minj]
            nums[minj]=nums[i]
            nums[i]=tmp
            count+=1
    print(' '.join(nums))
    print(count)


selectionSort(nums)

