import java.util.Map; import java.util.Scanner; import java.util.stream.IntStream; import static java.util.function.Function.identity; import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int height[] = new int[n]; for (int height_i = 0; height_i < n; height_i++) { height[height_i] = in.nextInt(); } Map candleHeightsCount = IntStream.of(height) .boxed() .collect(groupingBy(identity(), counting())); System.out.println(candleHeightsCount.get(candleHeightsCount.keySet().stream().max(Integer::compareTo).get())); } }