#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;
  scanf("%d", &n);
  int max_value = 0;
  int max_count = 0;
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    if (t > max_value) {
      max_value = t;
      max_count = 1;
    } else if (t == max_value) {
      max_count++;
    }
  }
  printf("%d\n", max_count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bb <main+0x9b>
lea    0xe99(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    118e <main+0x6e>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
jmp    11a8 <main+0x88>
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11a3 <main+0x83>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a8 <main+0x88>
jmp    11ad <main+0x8d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x34>
mov    -0x10(%rbp),%esi
lea    0xe3e(%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   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    1190 <main+0x70>
xor    %ebp,%ebp
lea    0xeb7(%rip),%r14
lea    0x4(%rsp),%r15
mov    $0x1,%r12d
xor    %r13d,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %esi,%esi
cmp    %ebx,%eax
sete   %sil
add    %r13d,%esi
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmovg  %r12d,%esi
add    $0x1,%ebp
mov    %esi,%r13d
cmp    (%rsp),%ebp
jl     1160 <main+0x40>
jmp    1192 <main+0x72>
xor    %esi,%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
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 i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %28, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %31
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
%15 = load i32, i32* %3
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i32, i32* %6
store i32 %18, i32* %3
store i32 1, i32* %4
br label %27
19: ; preds = %12
%20 = load i32, i32* %6
%21 = load i32, i32* %3
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %26
26: ; preds = %23, %19
br label %27
27: ; preds = %26, %17
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %8
31: ; preds = %8
%32 = load i32, i32* %4
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
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 i32
%3 = bitcast i32* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = bitcast i32* %2 to i8*
br label %12
9: ; preds = %12, %0
%10 = phi i32 [ 0, %0 ], [ %23, %12 ]
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
12: ; preds = %7, %12
%13 = phi i32 [ 0, %7 ], [ %24, %12 ]
%14 = phi i32 [ 0, %7 ], [ %23, %12 ]
%15 = phi i32 [ 0, %7 ], [ %22, %12 ]
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = icmp sgt i32 %17, %15
%19 = icmp eq i32 %17, %15
%20 = zext i1 %19 to i32
%21 = add nsw i32 %14, %20
%22 = select i1 %18, i32 %17, i32 %15
%23 = select i1 %18, i32 1, i32 %21
%24 = add nuw nsw i32 %13, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %24, %25
br i1 %26, label %12, label %9
}