n=gets.to_i
a = gets.split(' ').map(&:to_i)
ans = ""
def s(a, count)
  for i in 0..a.length-2
    v = i
    for j in i+1..a.length-1
      if a[j] < a[v]
        v = j
      end
    end
    if i != v
      a[i],a[v] = a[v],a[i]
      count += 1
    end
  end
  count
end
count = 0
count = s(a,count)
cnt = 0
a.each do |i|
  ans += "#{i}"
  if cnt != a.length-1
    ans += " "
  end
end
puts ans
puts count