unittest
{
	assert( [ "5", "4 2 5 1 3" ].parse.expand.solve == 3 );
	assert( [ "4", "4 3 2 1" ].parse.expand.solve == 4 );
	assert( [ "6", "1 2 3 4 5 6" ].parse.expand.solve == 1 );
	assert( [ "8", "5 7 4 2 6 8 1 3" ].parse.expand.solve == 4 );
	assert( [ "1", "1" ].parse.expand.solve == 1 );
}



import std.algorithm;
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 m = long.max;
	foreach( a; as )
	{
		m = min( m, a );
		ans += ( a <= m );
	}
	return ans;
}
