#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, a[1001], i, l;
  for (i = 0; i < 1001; ++i)
    a[i] = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &l);
    a[l]++;
  }
  printf("%d\n", n);
  for (i = l = 0; i < 1001; ++i)
    if (a[i] != 0) {
      l += a[i];
      if (l == n)
        break;
      printf("%d\n", n - l);
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xfb4(%rbp)
cmpl   $0x3e9,-0xfb4(%rbp)
jge    1172 <main+0x52>
movslq -0xfb4(%rbp),%rax
movl   $0x0,-0xfb0(%rbp,%rax,4)
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    113c <main+0x1c>
lea    0xe87(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11da <main+0xba>
lea    0xe5e(%rip),%rdi
lea    -0xfb8(%rbp),%rsi
call   1040 <scanf@plt>
movslq -0xfb8(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xfb0(%rbp,%rax,4)
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    118c <main+0x6c>
mov    -0x8(%rbp),%esi
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xfb8(%rbp)
movl   $0x0,-0xfb4(%rbp)
cmpl   $0x3e9,-0xfb4(%rbp)
jge    127e <main+0x15e>
movslq -0xfb4(%rbp),%rax
cmpl   $0x0,-0xfb0(%rbp,%rax,4)
je     1265 <main+0x145>
movslq -0xfb4(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%eax
add    -0xfb8(%rbp),%eax
mov    %eax,-0xfb8(%rbp)
mov    -0xfb8(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1250 <main+0x130>
jmp    127e <main+0x15e>
mov    -0x8(%rbp),%esi
sub    -0xfb8(%rbp),%esi
lea    0xda3(%rip),%rdi
call   1030 <printf@plt>
jmp    126a <main+0x14a>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    11fd <main+0xdd>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xfc0,%rsp
lea    0x10(%rsp),%rdi
xor    %ebp,%ebp
mov    $0xfa4,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11a0 <main+0x70>
lea    0xe92(%rip),%r14
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movslq 0x8(%rsp),%rax
addl   $0x1,0x10(%rsp,%rax,4)
add    $0x1,%ebp
mov    0xc(%rsp),%esi
cmp    %esi,%ebp
jl     1180 <main+0x50>
lea    0xe5c(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
movl   $0x0,0x8(%rsp)
xor    %ebp,%ebp
jmp    11cd <main+0x9d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    $0x3e9,%rbp
je     11ef <main+0xbf>
mov    0x10(%rsp,%rbp,4),%eax
test   %eax,%eax
je     11c0 <main+0x90>
add    0x8(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0xc(%rsp),%esi
sub    %eax,%esi
je     11ef <main+0xbf>
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    11c0 <main+0x90>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1001 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 1001
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [1001 x i32], [1001 x i32]* %3, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %6
16: ; preds = %6
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
br label %18
18: ; preds = %29, %16
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [1001 x i32], [1001 x i32]* %3, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
br label %29
29: ; preds = %22
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %18
32: ; preds = %18
%33 = load i32, i32* %2
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
store i32 0, i32* %5
store i32 0, i32* %4
br label %35
35: ; preds = %61, %32
%36 = load i32, i32* %4
%37 = icmp slt i32 %36, 1001
br i1 %37, label %38, label %64
38: ; preds = %35
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [1001 x i32], [1001 x i32]* %3, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %60
44: ; preds = %38
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [1001 x i32], [1001 x i32]* %3, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = load i32, i32* %5
%50 = add nsw i32 %49, %48
store i32 %50, i32* %5
%51 = load i32, i32* %5
%52 = load i32, i32* %2
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %55
54: ; preds = %44
br label %64
55: ; preds = %44
%56 = load i32, i32* %2
%57 = load i32, i32* %5
%58 = sub nsw i32 %56, %57
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %55, %38
br label %61
61: ; preds = %60
%62 = load i32, i32* %4
%63 = add nsw i32 %62, 1
store i32 %63, i32* %4
br label %35
64: ; preds = %54, %35
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1001 x i32]
%3 = bitcast [1001 x i32]* %2 to i8*
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %0, %10
%11 = phi i32 [ %18, %10 ], [ 0, %0 ]
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [1001 x i32], [1001 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
store i32 %17, i32* %15
%18 = add nuw nsw i32 %11, 1
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %10, label %21
21: ; preds = %10, %0
%22 = phi i32 [ %8, %0 ], [ %19, %10 ]
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
store i32 0, i32* %4
br label %24
24: ; preds = %21, %37
%25 = phi i64 [ 0, %21 ], [ %38, %37 ]
%26 = getelementptr inbounds [1001 x i32], [1001 x i32]* %2, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %37, label %29
29: ; preds = %24
%30 = load i32, i32* %4
%31 = add nsw i32 %30, %27
store i32 %31, i32* %4
%32 = load i32, i32* %1
%33 = icmp eq i32 %32, %31
br i1 %33, label %40, label %34
34: ; preds = %29
%35 = sub nsw i32 %32, %31
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %24, %34
%38 = add nuw nsw i64 %25, 1
%39 = icmp eq i64 %38, 1001
br i1 %39, label %40, label %24
40: ; preds = %29, %37
ret i32 0
}