import Control.Applicative

swap :: [Int] -> Int -> Int -> [Int]
swap xs i j = (take i xs) ++ [xs !! j] ++ (take (j - i - 1) $ drop (i + 1) xs) ++ [xs !! i] ++ (drop (j + 1) xs)

selection :: Int -> [[Int]] -> [[Int]]
selection n xss = foldl (\yss i -> let h = head yss; m = f h i in if i == m then yss else swap h i m : yss) xss [0 .. n - 1]
    where f ys i = foldl (\j k -> if ys !! k < ys !! j then k else j) i [i + 1 .. n - 1]

solve :: Int -> [Int] -> [[Int]]
solve n xs = selection n [xs]

main :: IO ()
main = do
    n  <- readLn
    xs <- map read <$> words <$> getLine
    let ls = solve n xs
    putStrLn $ unwords $ map show $ head ls
    print $ length ls - 1