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


def selectionSort(nums,n):
    count=0
    for i in range(n):
        minj=i
        for j in range(i+1,n):
            if nums[j]<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)
