# Enter your code here. Read input from STDIN. Print output to STDOUT n = int(raw_input()) candles = map(int,raw_input().split()) occurences = 0 curr_max = float('-inf') for i in candles: if i > curr_max: occurences = 1 curr_max = i elif i == curr_max: occurences += 1 print occurences