n = gets.to_i
a = (1..n).map { gets.to_f }
val_count = Hash[a.group_by(&:itself).map {|k, v| [k, v.size] }]
count_accum = 0
point = {}
val_count.keys.sort.each do |x|
  point[x] = count_accum * 3 + val_count[x] - 1
  count_accum += val_count[x]
end
a.each {|x| puts point[x] }
