#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, i, mx = 0, cnt;
  scanf("%d", &n);
  for (; n > 0; n--) {
    scanf("%d", &i);
    if (mx < i) {
      mx = i;
      cnt = 0;
    }
    if (mx == i)
      cnt++;
  }
  printf("%d", cnt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11a1 <main+0x81>
lea    0xea9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1179 <main+0x59>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    118e <main+0x6e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1193 <main+0x73>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
mov    -0x14(%rbp),%esi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%r14
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
xor    %r15d,%r15d
lea    0xc(%rsp),%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %ebp,%ecx
xor    %ebp,%ebp
cmp    %eax,%ebx
cmovl  %eax,%ebx
cmovl  %r15d,%ecx
setle  %bpl
add    %ecx,%ebp
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
cmp    $0x1,%eax
jg     1150 <main+0x30>
lea    0xe77(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %25, %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load i32, i32* %3
store i32 %16, i32* %4
store i32 0, i32* %5
br label %17
17: ; preds = %15, %10
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, -1
store i32 %27, i32* %2
br label %7
28: ; preds = %7
%29 = load i32, i32* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br label %8
8: ; preds = %0, %8
%9 = phi i32 [ %18, %8 ], [ undef, %0 ]
%10 = phi i32 [ %14, %8 ], [ 0, %0 ]
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = icmp slt i32 %10, %12
%14 = select i1 %13, i32 %12, i32 %10
%15 = select i1 %13, i32 0, i32 %9
%16 = icmp sge i32 %12, %10
%17 = zext i1 %16 to i32
%18 = add nsw i32 %15, %17
%19 = load i32, i32* %1
%20 = add nsw i32 %19, -1
store i32 %20, i32* %1
%21 = icmp sgt i32 %19, 1
br i1 %21, label %8, label %22
22: ; preds = %8
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}