unittest
{
	assert( [ "3 2", "100 50 200" ].parse.expand.solve == 1 );
	assert( [ "5 8", "50 30 40 10 20" ].parse.expand.solve == 2 );
	assert( [ "10 100", "7 10 4 5 9 3 6 8 2 1" ].parse.expand.solve == 2 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	auto d = 0L;
	auto m = long.max;
	foreach( i, a; as )
	{
		if( a < m )
		{
			m = a;
		}
		else
		{
			auto dd = a - m;
			if( d < dd )
			{
				ans = 1;
				d = dd;
			}
			else if( d == dd )
			{
				ans++;
			}
		}
	}
	return ans;
}
