solve :: Int -> [Int] -> [Int] -> [Int]
solve n aList ans
 | aList == [] = ans
 | otherwise = solve (n+1) (tail aList) $ ((length . (filter (\x -> x == n))) aList):ans

printAns :: [Int] -> IO()
printAns input
 | input == [] = return ()
 | otherwise = do
    print $ last input
    printAns $ init input

main = do
 _ <- getLine
 aList <- map read . words <$> getLine :: IO [Int]
 let bList = solve 1 aList [] 
 printAns bList