@staticmethod
def c():
    (n, *a) = map(int, sys.stdin.read().split())
    b = ([None] * n)
    prev = None
    j = (- 1)
    for (i, x) in sorted(enumerate(a), key=(lambda x: x[1])):
        if (x != prev):
            j += 1
        b[i] = j
        prev = x
    print(*b, sep='\n')
@staticmethod
def c():
    (n, *a) = map(int, sys.stdin.read().split())
    b = ([None] * n)
    prev = None
    j = (- 1)
    for (i, x) in sorted(enumerate(a), key=(lambda x: x[1])):
        if (x != prev):
            j += 1
        b[i] = j
        prev = x
    print(*b, sep='\n')