import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] candles = new int[n];
        int max=-1;
        int count=0;
        for(int n0=0; n0<n; n0++){
            candles[n0]= sc.nextInt();
            if(candles[n0]>max){
                max = candles[n0];
                count = 1;
            }
            else if(candles[n0]==max){
                count++;
            }
        }
        System.out.println(count);
    }
}