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