#selectionsort.rb
n=STDIN.gets.split[0].to_i
s=STDIN.gets.split
a=Array.new(n)
0.upto(n-1){|i|
  a[i]=s[i].to_i }
cnt=0
flag=0
0.upto(n-1){|i|
  minj=i
  i.upto(n-1){|j|
    if a[j] < a[minj] then
      minj=j
    end
  }
  if i != minj then
    w = a[minj]
    a[minj]=a[i]
    a[i]=w
    cnt += 1
  end
}

0.upto(n-2){|i|
    printf("%d ",a[i])}
printf("%d\n",a[n-1])
puts cnt 