def counting_sort(a,k):

    C = []

    for i in range(k):

        C.append(0)

    for ai in a:

        C[ai] += 1

    s = 0

    for i in range(k):

        s += C[i]

        C[i] = s

    b = []

    for i in range(len(a)):

        b.append(None)

    p = 0

    for i in range(k):

        while p < C[i]:

            b[p] = i

            p += 1

    return b





n = int(input())

a = list(map(int,input().split(' ')))

print(' '.join(map(str,counting_sort(a,10000))))
def sort(a, k):

    c = [0]*k

    for x in a:

        c[x] += 1

    b = []

    for i in range(len(c)):

        y = c[i]

        for _ in range(y):

            b.append(i)

    return b



n = int(input())

a = list(map(int, input().split(' ')))

b = sort(a, 10001)



print(' '.join(map(str, b)))
def counting_sort(a, k):
    C = []
    for i in range(k):
        C.append(0)
    for ai in a:
        C[ai] += 1
    s = 0
    for i in range(k):
        s += C[i]
        C[i] = s
    b = []
    for i in range(len(a)):
        b.append(None)
    p = 0
    for i in range(k):
        while p < C[i]:
            b[p] = i
            p += 1
    return b


n = int(input())
a = list(map(int, input().split(" ")))
print(" ".join(map(str, counting_sort(a, 10000))))

def sort(a, k):
    c = [0] * k
    for x in a:
        c[x] += 1
    b = []
    for i in range(len(c)):
        y = c[i]
        for _ in range(y):
            b.append(i)
    return b


n = int(input())
a = list(map(int, input().split(" ")))
b = sort(a, 10001)
print(" ".join(map(str, b)))

-def counting_sort(a, k): -    C = [] -    for i in range(k): -        C.append(0) -    for ai in a: -        C[ai] += 1 -    s = 0 -    for i in range(k): -        s += C[i] -        C[i] = s +def sort(a, k): +    c = [0] * k +    for x in a: +        c[x] += 1 -    for i in range(len(a)): -        b.append(None) -    p = 0 -    for i in range(k): -        while p < C[i]: -            b[p] = i -            p += 1 +    for i in range(len(c)): +        y = c[i] +        for _ in range(y): +            b.append(i) -print(" ".join(map(str, counting_sort(a, 10000)))) +b = sort(a, 10001) +print(" ".join(map(str, b)))