def swap(a, i, j)
  a[i] = a[i] ^ a[j]
  a[j] = a[i] ^ a[j]
  a[i] = a[i] ^ a[j]
end

def selection_sort(a, n)
  swap_count = 0
  (0...n).each {|i|
    minj = i
    (i...n).each {|j|
      minj = j if a[j] < a[minj]
    }
    if i != minj
      swap(a, i, minj)
      swap_count += 1
    end
  }
  swap_count
end

n = gets.to_i
a = gets.split(" ").map(&:to_i)
swap_count = selection_sort(a, n)
puts a.join(" ")
puts swap_count