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



ma, mi = 0, A0

B = {}

for a in A:

    b = a - mi

    B[b] = B.get(b, 0) + 1

    ma, mi = max(ma, b), min(mi, a)



print((B[ma]))
N, T, A0, *A = list(map(int, open(0).read().split()))



mi = A0

B = {}

for a in A:

    b = a - mi

    B[b] = B.get(b, 0) + 1

    mi = min(mi, a)



print((B[max(B.keys())]))

N, T, A0, *A = list(map(int, open(0).read().split()))
ma, mi = 0, A0
B = {}
for a in A:
    b = a - mi
    B[b] = B.get(b, 0) + 1
    ma, mi = max(ma, b), min(mi, a)
print((B[ma]))

N, T, A0, *A = list(map(int, open(0).read().split()))
mi = A0
B = {}
for a in A:
    b = a - mi
    B[b] = B.get(b, 0) + 1
    mi = min(mi, a)
print((B[max(B.keys())]))

-ma, mi = 0, A0 +mi = A0 -    ma, mi = max(ma, b), min(mi, a) -print((B[ma])) +    mi = min(mi, a) +print((B[max(B.keys())]))