import Data.List

score _ [] = []
score n x@((ih,vh):xs) = 
  let m = takeWhile (\ (i,v) -> v == vh) x
      r = dropWhile (\ (i,v) -> v == vh) x
      l = length m
      s = 3*n + l - 1
      y = map (\(i,v) -> (i,v,s)) m
  in
    y ++ (score (n+l) r)

ans i =
  let x = zip [1..] i
      s = sortBy (\(i0,v0) (i1,v1) -> compare v0 v1) x
      a = score 0 s
      s'= sortBy (\(i0,v0,s0) (i1,v1,s1) -> compare i0 i1) a
  in
    map (\(i0,v0,s0) -> s0) s'
  
main = do
  _ <- getLine
  c <- getContents
  let i = map read $ lines c :: [Float]
      o = ans i
  mapM_ print o

