import Control.Applicative

selectionSort (x:[]) = (0, [x])
selectionSort (x:xs) =
    let
        (s, selected) = select x xs
        (c, sorted)   = selectionSort selected
        c'            = if x /= s then c+1 else c
    in
        (c', s:sorted)

select :: Int -> [Int] -> (Int, [Int])
select n nums =
    let
        m = minimum nums
    in
        if m < n
           then (m, swap n m nums)
           else (n, nums)
    where
        swap :: Int -> Int -> [Int] -> [Int]
        swap _ _ []   = []
        swap n m (x:xs)
          | m == x    = n:xs
          | otherwise = x:(swap n m xs)

main :: IO ()
main = do
    getLine
    nums <- map read . words <$> getLine :: IO [Int]
    let (count, sorted) = selectionSort nums
    putStrLn $ unwords (show <$> sorted)
    print count

