# Enter your code here. Read input from STDIN. Print output to STDOUT
cases, candles = input(), map(int, raw_input().strip().split(" "))
maxHeight, nbCandles = 0, 0
for candle in candles:
    if candle > maxHeight:
        maxHeight = candle
        nbCandles = 1
    elif candle == maxHeight:
        nbCandles += 1
print nbCandles