#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int FLOOR, f[100000] = {0}, count[100000] = {0};
  int i, j;
  scanf("%d", &FLOOR);
  for (i = 0; i < FLOOR; i++) {
    scanf("%d", &f[i]);
  }
  count[0] = 0;
  printf("0 ");
  for (i = 1; i < FLOOR; i++) {
    for (j = 1; i - j >= 0; j++) {
      if (f[i] < f[i - j]) {
        count[i] = count[i - j] + 1;
        break;
      }
    }
    printf("%d ", count[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc3520,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x61a90(%rbp),%rdi
xor    %esi,%esi
mov    $0x61a80,%edx
call   1040 <memset@plt>
lea    -0xc3510(%rbp),%rdi
xor    %esi,%esi
mov    $0x61a80,%edx
call   1040 <memset@plt>
lea    0xe91(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0xc3514(%rbp)
mov    -0xc3514(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c6 <main+0x96>
movslq -0xc3514(%rbp),%rax
lea    -0x61a90(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe53(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc3514(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc3514(%rbp)
jmp    1182 <main+0x52>
movl   $0x0,-0xc3510(%rbp)
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc3514(%rbp)
mov    -0xc3514(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b4 <main+0x184>
movl   $0x1,-0xc3518(%rbp)
mov    -0xc3514(%rbp),%eax
sub    -0xc3518(%rbp),%eax
cmp    $0x0,%eax
jl     1284 <main+0x154>
movslq -0xc3514(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%eax
mov    -0xc3514(%rbp),%ecx
sub    -0xc3518(%rbp),%ecx
movslq %ecx,%rcx
cmp    -0x61a90(%rbp,%rcx,4),%eax
jge    126b <main+0x13b>
mov    -0xc3514(%rbp),%eax
sub    -0xc3518(%rbp),%eax
cltq
mov    -0xc3510(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0xc3514(%rbp),%rax
mov    %ecx,-0xc3510(%rbp,%rax,4)
jmp    1284 <main+0x154>
jmp    1270 <main+0x140>
mov    -0xc3518(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc3518(%rbp)
jmp    1201 <main+0xd1>
movslq -0xc3514(%rbp),%rax
mov    -0xc3510(%rbp,%rax,4),%esi
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc3514(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc3514(%rbp)
jmp    11e8 <main+0xb8>
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc3520,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc3518,%rsp
lea    0x61a90(%rsp),%r15
mov    $0x61a80,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x10(%rsp),%rdi
mov    $0x61a80,%edx
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe83(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11bd <main+0x7d>
xor    %ebx,%ebx
lea    0xe69(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     11a0 <main+0x60>
movl   $0x0,0x10(%rsp)
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x2,0xc(%rsp)
jl     125a <main+0x11a>
mov    $0x1,%ebx
mov    $0xffffffffffffffff,%r15
mov    $0xffffffff,%r12d
lea    0xe0f(%rip),%r14
jmp    122b <main+0xeb>
nopl   0x0(%rax)
mov    0x10(%rsp,%rsi,4),%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp,%rbx,4)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x1,%r15
cmp    %rax,%rbx
jge    125a <main+0x11a>
mov    0x61a90(%rsp,%rbx,4),%eax
lea    (%rbx,%r12,1),%rcx
mov    %r15,%rdx
nopl   0x0(%rax)
mov    %ecx,%esi
cmp    0x61a90(%rsp,%rsi,4),%eax
jl     1200 <main+0xc0>
mov    %rdx,%rcx
add    $0xffffffffffffffff,%rdx
cmp    $0xfffffffffffffffe,%rdx
jne    1240 <main+0x100>
jmp    120b <main+0xcb>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xc3518,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"0 \00"
@.str.2 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100000 x i32]
%3 = alloca [100000 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast [100000 x i32]* %2 to i8*
%6 = bitcast [100000 x i32]* %3 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 %18
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 0
store i32 0, i32* %19
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, 1
br i1 %22, label %23, label %54
23: ; preds = %18, %45
%24 = phi i64 [ %49, %45 ], [ 1, %18 ]
%25 = phi i64 [ %53, %45 ], [ 2, %18 ]
%26 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %24
%27 = load i32, i32* %26
%28 = add nuw i64 %24, 4294967295
br label %32
29: ; preds = %32
%30 = sub nsw i64 %24, %39
%31 = icmp eq i64 %39, %25
br i1 %31, label %45, label %32
32: ; preds = %23, %29
%33 = phi i64 [ 1, %23 ], [ %39, %29 ]
%34 = phi i64 [ %28, %23 ], [ %30, %29 ]
%35 = and i64 %34, 4294967295
%36 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp slt i32 %27, %37
%39 = add nuw nsw i64 %33, 1
br i1 %38, label %40, label %29
40: ; preds = %32
%41 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %35
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 1
%44 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %24
store i32 %43, i32* %44
br label %45
45: ; preds = %29, %40
%46 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %24
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = add nuw nsw i64 %24, 1
%50 = load i32, i32* %1
%51 = sext i32 %50 to i64
%52 = icmp slt i64 %49, %51
%53 = add nuw nsw i64 %25, 1
br i1 %52, label %23, label %54
54: ; preds = %45, %18
%55 = call i32 @putchar(i32 10)
ret i32 0
}