{-# LANGUAGE FlexibleContexts, OverloadedStrings #-} import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B import Data.Maybe (fromJust) import Text.Printf import Debug.Trace main = do [h,n] <- getInts hs <- replicateM (n-1) $ head <$> getInts let c = length . filter (>h) $ hs putStrLn $ pretty (c+1) where pretty x = show x ++ (case x `mod` 10 of 1 -> "st" 2 -> "nd" 3 -> "rd" _ -> "th") -- util getInts :: IO [Int] getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine substr :: Int -> Int -> B.ByteString -> B.ByteString substr b l s = B.take l $ B.drop b s