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 scan = new Scanner(System.in); int n = scan.nextInt(); int maxHeight = scan.nextInt(); int maxHeightCount = 1; for(int i = 0; i < (n-1); i++){ int currentHeight = scan.nextInt(); if(currentHeight == maxHeight){ maxHeightCount++; }else if(currentHeight > maxHeight){ maxHeight = currentHeight; maxHeightCount = 1; } } System.out.println(maxHeightCount); } }