using System;
using System.Collections.Generic;
using System.IO;
class Solution {
    static void Main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
        int numCandles = Convert.ToInt32(Console.ReadLine());
        int maxHeight = 0;
        int count = 0; 
        string currentHeight = Console.ReadLine(); 
        string[] hs = currentHeight.Split(' ');
        int[] heights = Array.ConvertAll<string, int>(hs, int.Parse);
        foreach (int h in heights){
            if(h > maxHeight){
                maxHeight = h;
                count = 1;
            }
            else if(h == maxHeight){
                count++;
            }
        }
        Console.WriteLine(count);
    }
}