CodeEff/ECCO huggingface dataset:
# Original solution
import sys


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(eval(input()))


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


A, B, C, X, Y = il()
m = A * X + B * Y
for i in range(2, 2 * max(X, Y) + 1, 2):
    tmp = A * max(X - i // 2, 0) + B * max(Y - i // 2, 0) + C * i
    if tmp < m:
        m = tmp
print(m)


# Optimized solution
import sys


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(eval(input()))


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


A, B, C, X, Y = il()

if A + B < 2 * C:
    print((A * X + B * Y))
    exit()
p = min(X, Y) * 2 * C
n = max(X - Y, Y - X)
if X < Y:
    p += min(2 * C * n, n * B)
else:
    p += min(2 * C * n, n * A)
print(p)
# Original solution

a, b, c, x, y = list(map(int, input().split(" ")))

res = 10**10
for i in range(0, max(x, y)*2+2, 2):
    a_piza = max(0, x - (i // 2))
    b_piza = max(0, y - (i // 2))
    res = min(res, a_piza*a + b_piza*b + i*c)

print(res)


# Optimized solution
a, b, c, x, y = list(map(int, input().split(" ")))
print((min([max(0, x-(i//2))*a + max(0, y-(i//2))*b + i*c for i in range(0, max(x, y)*2+2, 2)])))
# Original solution
x,y=list(map(int,input().split()));print((' YNeos'[len(set([2 if i in [2] else 1 if i in [4,6,9,11] else 0 for i in [x,y]]))::2]))

# Optimized solution
print((' YNeos'[len(set([2 if i in [2] else 1 if i in [4,6,9,11] else 0 for i in list(map(int,input().split()))]))::2]))
# Original solution
a,b,c=[1,3,5,7,8,10,12],[4,6,9,11],[2]
print(('YNeos'[len(set([0 if i in a else [1,2][i in b] for i in list(map(int,input().split()))]))!=1::2]))

# Optimized solution
print(('YNeos'[len(set([0 if i==2 else [1,2][i in [4,6,9,11]] for i in list(map(int,input().split()))]))!=1::2]))
# Original solution
# ABC062A - Grouping
x, y = list(map(int, input().rstrip().split()))
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]

if x == y:
    print("Yes")
elif x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
else:
    print("No")

# Optimized solution
# ABC062A - Grouping
x, y = list(map(int, input().rstrip().split()))
lst = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11]]

for i in lst:
    if x in i and y in i:
        print("Yes")
        exit()

print("No")
# Original solution

x , y = list(map(int,input().split()))
list1 = [1,3,5,7,8,10,12]
list2 = [4,6,9,11]
list3 = [2]

if x in list1:
	print(('Yes' if y in list1 else 'No'))
if x in list2:
	print(('Yes' if y in list2 else 'No'))
if x in list3:
	print(('Yes' if y in list3 else 'No'))

# Optimized solution
x , y = list(map(int,input().split()))
list1 = [1,3,5,7,8,10,12]
list2 = [4,6,9,11]
list3 = [2]

if x in list1 and y in list1:
	print('Yes')
elif x in list2 and y in list2:
	print('Yes')
elif x in list3 and y in list3:
	print('Yes')
else:
	print('No')
# Original solution
x,y = list(map(int, input().split()))

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

if x in a and y in a:
  print('Yes')
elif x in b and y in b:
  print('Yes')
else:
  print('No')

# Optimized solution
x,y = list(map(int, input().split()))
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c =[2]
if x in a and y in a:
  print('Yes')
elif x in b and y in b:
  print('Yes')
elif x==y==2:
  print('Yes')
else:
  print('No')
# Original solution

x,y = list(map(int,input().split()))
li = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
for i in li:
    if x  in i and y in i:
        print("Yes")
        exit()
print("No")

# Optimized solution
import sys
x,y = list(map(int,input().split()))
li = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
for i in li:
    if x  in i and y in i:
        print("Yes")
        sys.exit()
print("No")
# Original solution
x,y = list(map(int, input().split()))

A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
C=[2]

if (x in A and y in A) or (x in B and y in B) or (x in C and y in C):
  print('Yes')
else:
  print('No')

# Optimized solution
x,y = list(map(int, input().split()))
A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
print(("Yes" if {x, y} <= A or {x, y} <= B else "No"))
# Original solution
x,y=input().split()
a={"1","3","5","7","8","10","12"}
b={"4","6","9","11"}
print(("Yes" if {x,y}<=a or {x,y}<=b else "No"))

# Optimized solution
S="XACABABAABABA"
x,y=list(map(int,input().split()))
print(("Yes" if S[x]==S[y] else "No"))
# Original solution
s = set(map(int, input().split()))
b, c = {4, 6, 9, 11}, {2}
a = {i for i in range(1, 13)}-b-c
print(('Yes' if any(x & s == s for x in (a, b, c)) else 'No'))


# Optimized solution
a = [{1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}]
s = set(map(int, input().split()))
print(('Yes' if any(s <= x for x in a) else 'No'))
# Original solution
x, y = list(map(int, input().split(" ")))

group_list = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

finished = False
for gl in group_list:
    if (x in gl) and (y in gl):
        print("Yes")
        finished = True
if finished != True:
    print("No")

# Optimized solution
x, y = list(map(int, input().split(" ")))

group_list = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

for i in range(3):
    if x in group_list[i]:
        if y in group_list[i]:
            print("Yes")
        else:
            print("No")
# Original solution
#coding: utf-8

group={'a':[1,3,5,7,8,10,12],'b':[4,6,9,11],'c':[2]}

input_lines=input()
input_numbers=input_lines.split()
n=list(map(int,input_numbers))#n[0]とn[1]に数字

first_group = False
second_group = False

for i in group:
    for j in range(0,len(group[i])):
        if group[i][j] == n[0]:
            first_group = True
        if group[i][j] == n[1]:
            second_group = True
    if first_group == True and second_group==False or first_group == False and second_group == True:
        print("No")
        break

if first_group and second_group:
    print("Yes")

# Optimized solution
group =[0,1,3,1,2,1,2,1,1,2,1,2,1]

input_lines=input()
input_numbers=input_lines.split()
n=list(map(int,input_numbers))

if group[n[0]] == group[n[1]]:
    print("Yes")
else:
    print("No")
# Original solution
a,b=input().split()
lis=(("1","3","5","7","8","10","12"),("4","6","9","11"),("2"))
for gn, row in enumerate(lis):
    try:
        A=(gn, row.index(a))
        break
    except ValueError:
        pass
for gn, row in enumerate(lis):
    try:
        B=(gn, row.index(b))
        break
    except ValueError:
        pass    
print(("Yes" if A[0]==B[0] else "No"))    

# Optimized solution
x,y = list(map(int,input().split(" ")))
a=(1,3,5,7,8,10,12)
b=(4,6,9,11)
if (x in a and y in a) or (x in b and y in b):
    print("Yes")
else:
    print("No")
# Original solution
x, y = list(map(int, input().split()))
G = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

print(('Yes' if any(x in g and y in g for g in G) else 'No'))

# Optimized solution
G = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
x, y = list(map(int, input().split()))

print(('Yes' if any(x in g and y in g for g in G) else 'No'))
# Original solution
x, y = list(map(int, input().split()))
A = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
ans = 'No'
for a in A:
    if x in a and y in a:
        ans = 'Yes'
        break
print(ans)

# Optimized solution
x, y = list(map(int, input().split()))
A = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

ans = 'No'
for a in A:
    if x in a and y in a:
        ans = 'Yes'
        
print(ans)
# Original solution
a,b=list(map(int,input().split()))
k=list(map(int,input().split()))

sa=0
ans=1
ma=max(k)

for i in range(a-1):
    if k[i]==ma:
        ma=max(k[i+1:a])
    tmp=ma-k[i]
    if tmp>sa:
        sa=tmp
        ans=1
    elif tmp==sa:
        ans+=1

    

print(ans)

# Optimized solution
a,b=list(map(int,input().split()))
k=list(map(int,input().split()))

sa=0
ans=1

n=k[a-1]

for i in range(a-2,-1,-1):
    if k[i]>n:
        n=k[i]
    tmp=n-k[i]
    if tmp>sa:
        sa=tmp
        ans=1
    elif tmp==sa:
        ans+=1

    

print(ans)
# Original solution
N, T = list(map(int, input().split()))
num_list = input().split()
num_list = [int(x) for x in num_list]

dif = 0
count = 0

for index, i in enumerate(num_list):
    for j in num_list[index:]:
   #     print(j)
        if j > i and (j - i) >= dif:
            dif = j - i

for index, i in enumerate(num_list):
    for j in num_list[index:]:
        if j - i == dif:
            count += 1

print(count)

# Optimized solution
N, T = list(map(int, input().split()))
num_list = input().split()
num_list = [int(x) for x in num_list]

count = 0
profit = 0
min_val = num_list[0]

for num in num_list:
    if num < min_val:
        min_val = num
    elif num - min_val == profit:
        count += 1
    elif num - min_val > profit:
        count = 1
        profit = num - min_val

print(count)
# Original solution
N, T = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]

max_profit = 0
ans = 1
left = 0
right = 1

while right < N:
    if a[left] < a[right]:
        profit = a[right] - a[left]
        if profit == max_profit:
            ans += 1
        else:
            max_profit = max(max_profit, profit)
    else:
        left = right
    right += 1

print(ans)


# Optimized solution
N, T = [int(v) for v in input().split()]
a = [int(v) for v in input().split()]

max_profit = 0
ans = 1
left = 0
right = 1

min_a = a[0]
for i in range(1, N):
    if min_a < a[i]:
        profit = a[i] - min_a
        if profit == max_profit:
            ans += 1
        else:
            max_profit = max(max_profit, profit)
    else:
        min_a = min(min_a, a[i])

print(ans)
# Original solution
from bisect import bisect_left
from collections import defaultdict

N, T, *A = list(map(int, open(0).read().split()))

inf = 10 ** 9 + 7
dp = [inf] * (N + 1)
ctr = defaultdict(int)
for i in range(N):
    idx = bisect_left(dp, A[i])
    dp[idx] = A[i]
    if idx != 0:
        ctr[A[i] - dp[0]] += 1

print((ctr[max(ctr)]))


# Optimized solution
from collections import defaultdict

N, T, *A = list(map(int, open(0).read().split()))

ctr = defaultdict(int)
m = 10 ** 9 + 7
for i in range(N):
    m = min(m, A[i])
    ctr[A[i] - m] += 1

print((ctr[max(ctr)]))
# Original solution
N,T = list(map(int,input().split()))
A = list(map(int,input().split()))
dif = []
max_A = 0
for i in range(N):
    max_A = max(max_A,A[-1-i])
    dif.append(max_A-A[-1-i])
ans = 0
dif.sort(reverse=True)
for i in range(N-1):
    if dif[i]!=dif[i+1]:
        print((i+1))
        break

# Optimized solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

lo = 10**18
hi = 0
d = 0
res = 0


for i in range(N):
    if lo > A[i]:
        lo = A[i]
        hi = 0
    if hi < A[i]:
        hi = A[i]
        if d == hi - lo:
            res += 1
        elif d < hi - lo:
            d = hi - lo
            res = 1

print(res)
# Original solution
N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
buy = A[0]
max_profit = 0
ans = 1
for i in range(1,N):
    if A[i] > buy:
        if A[i] - buy > max_profit:
            max_profit = A[i] - buy
            ans = 1
        elif A[i] - buy == max_profit:
            ans += 1
    else:
        buy = A[i]
print(ans)


# Optimized solution
N, T = list(map(int, input().split()))
A = [int(x) for x in input().split()]
cost, buy, mprofit = 1, 10e9, 0
for a in A:
    if a < buy:
        buy = a
    else:
        profit = a - buy
        if profit == mprofit:
            cost += 1
        if profit > mprofit:
            mprofit = profit
            cost = 1
print(cost)
# Original solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

B = [A[i:] for i in range(1, N)]

ans = 0
maxv = 0
for i in range(N-1):
    z = max(B[i]) - A[i]
    if maxv > z:
        continue
    elif maxv < z:
        maxv = z
        ans = 1
    else:
        ans += 1

print(ans)



# Optimized solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

B = [max(A[i:]) for i in range(1, N)]

ans = 0
maxv = 0
for i in range(N-1):
    z = B[i] - A[i]
    if maxv > z:
        continue
    elif maxv < z:
        maxv = z
        ans = 1
    else:
        ans += 1

print(ans)
# Original solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

B = [max(A[i:]) for i in range(1, N)]

ans = 0
maxv = 0
for i in range(N-1):
    z = B[i] - A[i]
    if maxv > z:
        continue
    elif maxv < z:
        maxv = z
        ans = 1
    else:
        ans += 1

print(ans)

# Optimized solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
B = A[::-1]
C = []

maxv = 0
for i in range(N):
    if maxv > B[i]:
        C.append(maxv)
    else:
        maxv = B[i]
        C.append(maxv)

C = C[::-1]

ans = 0
maxv = 0
for i in range(N-1):
    z = C[i] - A[i]
    if maxv > z:
        continue
    elif maxv < z:
        maxv = z
        ans = 1
    else:
        ans += 1

print(ans)
# Original solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
B = A[::-1]
C = []

maxv = 0
for i in range(N):
    if maxv > B[i]:
        C.append(maxv)
    else:
        maxv = B[i]
        C.append(maxv)

C = C[::-1]

ans = 0
maxv = 0
for i in range(N-1):
    z = C[i] - A[i]
    if maxv > z:
        continue
    elif maxv < z:
        maxv = z
        ans = 1
    else:
        ans += 1

print(ans)



# Optimized solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

maxp = 0
minv = float('inf')
ans = 0
for a in A:
    p = a - minv
    if p > maxp:
        maxp = p
        ans = 1
    elif p == maxp:
        ans += 1

    minv = min(minv, a)

print(ans)
# Original solution
# ABC047D - 高橋君と見えざる手 / An Invisible Hand (ARC063D)
def main():
    N, T = tuple(map(int, input().split()))
    A = tuple(map(int, input().split()))
    cur, cand = A[0], []
    for i in A:
        if i < cur:
            cur = i
        else:
            cand += [i - cur]
    x = max(cand)
    ans = sum(i == x for i in cand)
    print(ans)


if __name__ == "__main__":
    main()

# Optimized solution
# ABC047D - 高橋君と見えざる手 / An Invisible Hand (ARC063D)
def main():
    N, T, *A = list(map(int, open(0).read().split()))
    cur, cand = A[0], []
    for i in A:
        if i < cur:
            cur = i
        else:
            cand += [i - cur]
    x = max(cand)
    ans = len([1 for i in cand if i == x])
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
n,t = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = [0]*n
for i in range(n):
    flag = min(a[:i+1])
    ans[i] = a[i]-flag
print((ans.count(max(ans))))

# Optimized solution
n,t = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = [0]*n
flag = float("inf")
for i in range(n):
    flag = min(flag,a[i])
    ans[i] = a[i]-flag
print((ans.count(max(ans))))
# Original solution
def main():
    n, t, *a = list(map(int, open(0).read().split()))
    a += [-float("Inf")]
    b = [max(a[i + 1:]) for i in range(n)]
    c = []
    for i in range(n):
        x = a[i]
        y = b[i]
        c.append(y - x)

    d = c.count(max(c))
    print(d)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    n, t, *a = list(map(int, open(0).read().split()))
    b = 0
    c = float("Inf")
    d = 0
    for i in range(n):
        x = a[i]
        if x - c > b:
            b = x - c
            d = 1
        elif x - c == b:
            d += 1
        c = min(c, x)

    print(d)


if __name__ == '__main__':
    main()
# Original solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

saeki = []
maxsaeki = 0
ans = 0
maxringo = max(a)

for i in range(len(a)-1):
    if a[i] == maxringo:
        maxringo = max(a[i+1:])
    s = maxringo - a[i]
    if s == maxsaeki:
        ans += 1
    if s > maxsaeki:
        ans = 1
        maxsaeki = s

print(ans)

# Optimized solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

ma = a[-1]
m = 1
maxsaeki = 0
ans = 0

for i in range(n-2,-1,-1):
    if a[i] > ma:
        ma = a[i]
        m = 1
    elif a[i] < ma:
        if (ma - a[i]) > maxsaeki:
            maxsaeki = ma-a[i]
            ans = 1
        elif (ma - a[i]) == maxsaeki:
            ans += 1

print(ans)
# Original solution
n,t=list(map(int,input().split()))
a=list(map(int,input().split()))
saisyo=min(a)
saidai=0
count=0

for i in range(n-1):
    x=a.pop()
    if x==saisyo:
        saisyo=min(a)
    elif x-saisyo>=saidai:
        mouke=x-saisyo
        if mouke>saidai:
            saidai=mouke
            count=1
        elif mouke==saidai:
            count+=1
    
print(count)

# Optimized solution
n,t=list(map(int,input().split()))
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)
# Original solution
input('').split()
A = [int(x) for x in input('').split()]
max = 0
msp = A[0]
for i in range(0,len(A)-1):
  if msp <= A[i]:
    continue
  else:
    msp = A[i]
    for j in range(i+1,len(A)):
        pf_t = A[j] - A[i]
        if pf_t > max:
          max = pf_t
          spot = [(i,j)]
        elif pf_t == max:
          spot.append((i,j))
print(len(spot))

# Optimized solution
input('').split()
A = [int(x) for x in input('').split()]
max = 0
count = 0
pl = 0
msp = A[0]
for i in range(1,len(A)):
  pl_t = pl + A[i] - A[i-1]
  if pl_t <= 0:
    pl = 0
  else:
    pl = pl_t
    if max < pl_t:
      max = pl_t
      count = 1
    elif max == pl_t:
      count += 1
print(count)
# Original solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

max_benefit = 0
ans = 0
for i in range(n - 1):
    benefit = (max(a[i + 1:]) - a[i])
    if  benefit == max_benefit:
        ans += 1
    elif benefit > max_benefit:
        ans = 1
        max_benefit = benefit

print(ans)

# Optimized solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

max_benefit = 0
a_min = a[0]
ans = 0
for i in range(1, n):
    if a[i] < a_min:
        a_min = a[i]
    benefit = (a[i] - a_min)
    if  benefit == max_benefit:
        ans += 1
    elif benefit > max_benefit:
        ans = 1
        max_benefit = benefit

print(ans)
# Original solution
import heapq
n,t = list(map(int,input().split()))
ai = [int(i) for i in input().split()]


rev_ai = [ai[n-1]*(-1)]

ans = [0,0]

heapq.heapify(rev_ai)
#print(rev_ai)
for i in range(1,n):
    #print(ai[n-1-i])
    dif = rev_ai[0]*(-1) - ai[n-1-i]
    if dif > ans[0]:
        ans = [dif,1]
    elif dif == ans[0]:
        ans[1] += 1
    #print(rev_ai[0])
    heapq.heappush(rev_ai,ai[n-1-i]*(-1))

print((ans[1]))

# Optimized solution
#import heapq
n,t = list(map(int,input().split()))
ai = [int(i) for i in input().split()]


#rev_ai = [ai[n-1]*(-1)]

ans = [0,0]

max_ai = ai[n-1]

#heapq.heapify(rev_ai)
#print(rev_ai)
for i in range(1,n):
    #print(ai[n-1-i])
    dif = max_ai - ai[n-1-i]
    if dif > ans[0]:
        ans = [dif,1]
    elif dif == ans[0]:
        ans[1] += 1
    #print(rev_ai[0])
    #heapq.heappush(rev_ai,ai[n-1-i]*(-1))
    max_ai = max(max_ai,ai[n-1-i])

print((ans[1]))
# Original solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

remain_max = [a[-1]]*n
for i in range(1, n):
    remain_max[-(i+1)] = max(a[-i], remain_max[-i])

diffs1 = [0]*n
for i in range(n):
    diffs1[i] = remain_max[i] - a[i]

max_diff1 = 0
ans1 = 0
for i in range(n):
    if diffs1[i] > max_diff1:
        max_diff1 = diffs1[i]
        ans1 = 1
    elif diffs1[i] == max_diff1:
        ans1 += 1
# print(diffs1, ans1)

remain_min = [a[0]]*n
for i in range(1, n):
    remain_min[i] = min(a[i-1], remain_min[i-1])

diffs2 = [0]*n
for i in range(n):
    diffs2[i] = a[i] - remain_min[i]

max_diff2 = 0
ans2 = 0
for i in range(n):
    if diffs2[i] > max_diff2:
        max_diff2 = diffs2[i]
        ans2 = 1
    elif diffs2[i] == max_diff2:
        ans2 += 1
# print(diffs2, ans2)

print((min(ans1, ans2)))
        


# Optimized solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

remain_max = [a[-1]]*n
for i in range(1, n):
    remain_max[-(i+1)] = max(a[-i], remain_max[-i])

diffs = [0]*n
for i in range(n):
    diffs[i] = remain_max[i] - a[i]

max_diff = 0
ans = 0
for i in range(n):
    if diffs[i] > max_diff:
        max_diff = diffs[i]
        ans = 1
    elif diffs[i] == max_diff:
        ans += 1

print(ans)
# Original solution
from itertools import combinations

n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

diff = sorted([t[1]-t[0] for t in combinations(a, 2)], reverse=True)

print((diff.count(diff[0])))

# Optimized solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

mn = a[0]
l = []

for x in a:
    l.append(x-mn)
    mn = min(mn, x)

l.sort()
print((l.count(l[-1])))
# Original solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

mn = a[0]
d = {}

for x in a:
    d[x-mn] = d.get(x-mn, 0) + 1
    mn = min(mn, x)

print((max(list(d.items()), key=lambda x:x[0])[1]))


# Optimized solution
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

mn = a[0]
d = {}

for x in a:
    d[x-mn] = d.get(x-mn, 0) + 1
    mn = min(mn, x)

print((d[max(d.keys())]))
# Original solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

benefit = -1
cost = 1

for i in range(N - 1):
    for j in range(i + 1, N):
        if benefit == A[j] - A[i]:
            cost += 1
        if benefit < A[j] - A[i]:
            cost = 1
            benefit = A[j] - A[i]

print(cost)

# Optimized solution
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))

minA = A[0]
benefit = 0
maxBenefit = 0
cost = 0

for i in range(N):
    if A[i] < minA:
        minA = A[i]
    else:
        benefit = A[i] - minA
        if benefit > maxBenefit:
            maxBenefit = benefit
            cost = 1
        elif benefit == maxBenefit:
            cost += 1

print(cost)
# Original solution
import sys
from heapq import heappush, heappop
from collections import Counter

n, t, *a = list(map(int, sys.stdin.read().split()))

def main():
  cand = []
  hq = [a[0]]
  for x in a[1:]:
    y = heappop(hq)
    cand.append(x - y)
    heappush(hq, x)
    heappush(hq, y)
  c = Counter(cand)
  ans = c[max(c.keys())]
  print(ans)
  
if __name__ == '__main__':
  main()

# Optimized solution
import sys
from collections import Counter

n, t, *a = list(map(int, sys.stdin.read().split()))

def main():
  cand = []
  mi = a[0]
  for x in a[1:]:
    cand.append(x - mi)
    mi = min(mi, x)
  c = Counter(cand)
  ans = c[max(c.keys())]
  print(ans)
  
if __name__ == '__main__':
  main()
# Original solution
def readints(): return list(map(int,input().split()))

N, T = readints()
a = list(readints())

mdiff = 0
mi = 1145141919
for i in range(N):
    mi = min(mi, a[i])
    mdiff = max(mdiff, a[i] - mi)

mi = 1145141919
ans = 0
for i in range(N):
    mi = min(mi, a[i])
    ans += (a[i] - mi == mdiff)

print(ans)

# Optimized solution
def readints(): return list(map(int,input().split()))

N, T = readints()
a = list(readints())

mdiff = 0
mi = 1145141919
for x in a:
    mi = min(mi, x)
    mdiff = max(mdiff, x - mi)

mi = 1145141919
ans = 0
for x in a:
    mi = min(mi, x)
    ans += (x - mi == mdiff)

print(ans)