def selectionSort(nums):
    k=0
    for i,n in enumerate(nums):
        try:
            m=min(nums[i+1:])
            j=nums.index(m)
            if n>m:
                nums[i],nums[j]=nums[j],nums[i]
                k+=1
        except:
            continue
    return nums,k
    
n=int(input())
nums=list(map(int,input().split()))

nums,k=selectionSort(nums)
print(*nums)
print(k)