Problem:
 Score : 300 points    Problem Statement  Given is a permutation P_1, \ldots, P_N of 1, \ldots, N .
Find the number of integers i  (1 \leq i \leq N) that satisfy the following condition:   For any integer j  (1 \leq j \leq i) , P_i \leq P_j .       Constraints   1 \leq N \leq 2 \times 10^5  P_1, \ldots, P_N is a permutation of 1, \ldots, N .  All values in input are integers.         Input  Input is given from Standard Input in the following format:  N  P_1  ...  P_N       Output  Print the number of integers i that satisfy the condition.        Sample Input 1 5
4 2 5 1 3      Sample Output 1 3  i=1 , 2 , and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1 . Similarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.       Sample Input 2 4
4 3 2 1      Sample Output 2 4  All integers i  (1 \leq i \leq N) satisfy the condition.       Sample Input 3 6
1 2 3 4 5 6      Sample Output 3 1  Only i=1 satisfies the condition.       Sample Input 4 8
5 7 4 2 6 8 1 3      Sample Output 4 4       Sample Input 5 1
1      Sample Output 5 1

Solution (Python):
class BinaryIndexedTree:
    def __init__(self,n,default = 0):
        self.s = [default]*(n+1)
        self.n = n
    
    def add(self,val,idx):
        while idx < self.n+1:
            self.s[idx] = self.s[idx] + val
            idx += idx&(-idx)
        return
    
    def get(self,idx):
        res = 0
        while idx > 0:
            res = res + self.s[idx]
            idx -= idx&(-idx)
        return res

n = int(input())
P = list(map(int,input().split()))

BIT = BinaryIndexedTree(n)
ans = 0
for p in P[::-1]:
    ans += (BIT.get(p) >= p-1)
    BIT.add(1,p)
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
p = list(map(int, readline().split()))
temp = p[0]
lis = p[1:]
ans = 1

for i in lis:
    if (i > temp):
        pass
    else:
        temp = i
        ans += 1

print(ans)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))

num = p[0]
ans = 0

for i in range(n):
	if p[i] <= num:
		ans += 1
		num = p[i]
print(ans)

Solution (Python):
N = int(input())
P = [-1]
P += list(map(int, input().split(' ')))
mini = 10 ** 9
count = 0
for i in range(1,N+1):
    if P[i] <= mini:
        mini = P[i]
        count += 1
print(count)

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque


from collections import Counter

from itertools import accumulate,combinations,permutations

from heapq import heapify,heappop,heappush


from functools import lru_cache

from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    

    N = int(input())
    
    A = tuple(map(int, input().split())) 
    
    

    ma=10**6
    tot=0
    for a in A:
        if a<=ma:
            tot+=1
            ma=a
    print(tot)




if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n = int(input())
    P = list(map(int, input().split()))

    minimum = INF
    ans = 0
    for i in range(n):
        if minimum >= P[i]:
            minimum = P[i]
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
pl = list(map(int, input().split()))


curr_min = pl[0]
ans = 0
for p in pl:
    if p <= curr_min:
        ans += 1
        curr_min = p

print(ans)

Solution (Python):
n,*l=map(int,open(0).read().split())
t,c=n+1,0
for i in l:
  if i<t: t=i; c+=1
print(c)

Solution (Python):
def main():
    n = int(input())
    p = map(int, input().split())

    num = float('inf')
    r = 0
    for pe in p:
        if num >= pe:
            r += 1
            num = pe
    print(r)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())


pl=list(map(int,input().split()))


mn=pl[0]
mnl=[]
for i in range(n):
    mn=min(mn,pl[i])
    mnl.append(mn)
res=0
for i in range(n):
    if pl[i]<=mnl[i]: res+=1
print(res)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
pmin = p[0]
ans = 0
for i in range(n):
  if pmin >= p[i]:
    pmin = p[i]
    ans += 1
print(ans)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
mini=p[0]
ans=0
for i in range(n):
    if p[i]<=mini:
        ans+=1
        mini=min(p[i],mini)
print(ans)

Solution (Python):
N=int(input())
P=list(map(int,input().split()))
A=set()
A.add(P[0])
a=P[0]
for i in range(N):
  if P[i]<a:
    A.add(P[i])
    a=P[i]
print(len(A))

Solution (Python):
n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if premin>=x:
    ans+=1
    premin=x
print(ans)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
m = 2 * 10**5 + 1
ans = 0
for i in range(n) :
    if m > p[i] :
        ans += 1
        m = p[i]
print(ans)

Solution (Python):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *P = map(int, read().split())
min = P[0] 
ans = 1
for i in range(1,N):
    if P[i] > min:
        continue
    else:
        ans += 1
        min = P[i]
print(ans)

Solution (Python):
N = int(input())
lis = list(map(int, input().split()))
min_value = lis[0]
ans = 0

for i in lis:
    if min_value >= i:
       ans += 1
       min_value = i

print(ans)

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))

n = I()
p = LI()
p_min = p[0]
c = 0
for pi in p:
    if pi <= p_min:
        p_min = pi
        c += 1
print(c)

Solution (Python):
N = int(input())
P = [int(x) for x in input().split()]
Count = 1
MIN = P[0]
for T in range(1,N):
    if P[T]<MIN:
        MIN = P[T]
        Count += 1   
print(Count)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
minx = max(p)
for i in range(n):
    minx = min(p[i],minx)
    if minx >= p[i]:
        cnt += 1
print(cnt)

Solution (Python):
N=int(input())
P=list(map(int,input().split()))

p_min=10**10
cnt=0
for p in P:
  if p_min >= p:
    cnt+=1
    p_min=p
    
print(cnt)

Solution (Python):
N = int(input())
P = [int(x) for x in input().split()]
Count = 1
MIN = P[0]
for T in range(1,N):
    if P[T]<MIN:
        MIN = P[T]
        Count += 1   
print(Count)

Solution (Python):
N = int(input())
P = [int(x) for x in input().split()]
Count = 1
MIN = P[0]
for T in range(1,N):
    if P[T]<MIN:
        MIN = P[T]
        Count += 1   
print(Count)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
a = 10**9
ans = 0
for i in range(n):
    if l[i] <= a:
        ans += 1
        a = l[i]
print(ans)

Solution (Python):

def main():
    N = int(input())
    P = list(map(int,input().split()))
    count = 0
    min = 10000000000
    for p in P:
        if(p<=min):
            count+=1
            min=p
    print(count)
main()

Solution (Python):
N=int(input())
p=list(map(int,input().split()))

Q=0
min_p=1000000
for i in range(N):
    if min(p[i],min_p)>=p[i]:
        Q+=1
    min_p=min(p[i],min_p)
print(Q)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))

min_num = 1000000
count = 0

for num in P:
    if num <= min_num:
        count += 1
        min_num = num

print(count)

Solution (Python):
N=int(input())
*P,=map(int,input().split())

ans=0
count=P[0]
for p in P:
    if p<=count:
        ans+=1
        count=p

print(ans)

Solution (Python):

 

 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
 

 







 
N=int(input())
P = list(map(int, input().split()))

count = 1
min = P[0]

for i in range(1,N):
    if min > P[i]:
        count+=1
        min = P[i]

print(count)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))

count = 0
num = P[0]
for i in range(N):
    if P[i] <= num:
        count += 1
        num = P[i]
print(count)

Solution (Python):
N = input("")
L = input("").split(" ")
suc = int(N)
min_ = 200001

for i in range(int(N)):
    if (L[i] == 1):
        min_= 1
        continue
    if (int(min_) < int(L[i])):
        suc -= 1
        continue
    if (int(min_) >= int(L[i])):
        min_ = L[i]
print(suc)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
c=l=0
for i in range(n):
    if i==0 or p[i]<l:
        l=p[i]
        c+=1
        if p[i]==1:break
print(c)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
min =10**9
ans = 0
for i in range(n):
    if p[i] <= min:
        ans += 1
        min = p[i]
print(ans)

Solution (Python):


import sys
from copy import deepcopy
input=sys.stdin.readline

def main():
    N=int(input())
    P=list(map(int,input().split()))
    minn=max(P)
    cnt=0
    for i in range(N):
        if minn >= P[i]:
            cnt+=1
            minn=P[i]
    print(cnt)
    
if __name__=="__main__":
    main()

Solution (Python):
N = int(input())
P = list(map(int,input().split()))

count =0
mi= 3*(10**5) 
for i in range(N):
    if mi >= P[i]:
        count +=1
        mi=P[i]

print(count)

Solution (Python):
N = int(input())
P = list(map(int,input().split()))


inf = float("inf")
minimum = inf
counter = 0
for i in range(N):
    if P[i]<minimum:
        minimum = P[i]
        counter += 1

    

print(counter)

Solution (Python):
def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    min = P[0]
    ans = 1
    for i in P:
        if i < min:
            min = i
            ans += 1
    print(ans)
resolve()

Solution (Python):
N=int(input())
P=list(map(int,input().split()))
count=0
MIN=P[0]
for num in P:
    if num<=MIN:
        count+=1
        MIN=num
    

print(count)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
c = 0
m = n + 1
for i in p:
  if i < m:
    c += 1
    m = i
print(c)

Solution (Python):
n = int(input())
P = list(map(int, input().split()))

ans = 0
tmp = P[0]
for i in range(n):
  if P[i] <= tmp:
    ans += 1
    tmp = P[i]
  else:
    pass
print(ans)

Solution (Python):






N = int(input())
P = list(map(int, input().split()))





ans = 0
tmp = P[0]
for i in range(N):
    if P[i] <= tmp:
        ans += 1
        tmp = P[i]
print(ans)

Solution (Python):








N = int(input())

P = list(map(int,input().split()))





c=0
mi=10**8
for i in range(N):
    if P[i] < mi:
        mi = P[i]
        if P[i]==1:
            c+=1
            print(c)
            exit()

        c+=1

Solution (Python):
N=int(input())
P=list(map(int,input().split()))
cnt,minimum=0,max(P)
for i in range(N):
    if P[i]<=minimum:
        cnt+=1
        minimum=P[i]
print(cnt)

Solution (Python):
N = int(input())
P = list(map(int,input().split()))
mi = 10**7
b = [0]*N
for i in range(N):
    if mi > P[i]:
        b[i] += 1
        mi=P[i]
print(sum(b))

Solution (Python):
N=int(input())
ls=list(map(int,input().split()))
a=ls[0]+1
ans=0
for i in range(N):
  if ls[i]<a:
    ans+=1
    a=ls[i]
else:
  print(ans)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))

min_p = p[0]
count = 1

for i in p[1:]:
    if i < min_p:
        count += 1
        min_p = i

print(count)

Solution (Python):
N = int(input())
P = [int(x) for x in input().split()]
R = 1000000
c = 0
for i in range(N):
  if min(R, P[i])==P[i]:
    c += 1
    R = P[i]
  else:
    pass
print(c)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

p = [0] * n
minv = 1e9
for i in range(n):
  minv = min(minv, a[i])
  p[i] = minv

ans = 0
for i in range(n):
  if a[i] <= p[i]:
    ans += 1

print(ans)

Solution (Python):
def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    num = P[0]
    ans = 1
    for i in range(1,N):
        if num >= P[i]:
            ans+=1
            num = P[i]
    print(ans)

    return

resolve()

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
ans = 1
pmin = p[0]
for i in range(1, n):
  if pmin >= p[i]:
    ans += 1
    pmin = p[i]
print(ans)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
pmin=p[0]
cnt=1
for i in range(1,n):
  if pmin >= p[i]:
    pmin = p[i]
    cnt += 1
print(cnt)

Solution (Python):
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
P=nl()

INF=10**18
min_val=INF
ans=0
for i in P:
    if(i<=min_val):
        min_val=i
        ans+=1

print(ans)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
c=0
d=p[0]
for i in range(n):
  if p[i]<= d:
    d=p[i]
    c+=1
print(c)

Solution (Python):
n = int(input())
ppp = list(map(int, input().split()))
curr = 10 ** 6
ans = 0
for p in ppp:
    if p < curr:
        ans += 1
        curr = p
print(ans)

Solution (Python):
import collections

N = int(input())
P = list(map(int,input().split()))

m = max(P)
cnt = 0

for i in range(N):
    if P[i] <= m:
        cnt += 1
        m = P[i]

print(cnt)

Solution (Python):
n = int(input())
data = list(map(int, input().split()))

ans = 0

min_ = data[0]
for i in range(n):
    
    if min_ >= data[i]:
        min_ = data[i]
        ans += 1

print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
minim = P[0]
num = 0
for i in range(N):
    if P[i] <= minim:
        num += 1
        minim = P[i]
print(num)

Solution (Python):
N=int(input())
P=list(map(int,input().split()))

Min=2*100000+1
ans=0

for i in range(N):
  if Min>P[i]:
    ans+=1
  Min=min(Min,P[i])

print(ans)

Solution (Python):



input()
first, *p = map(int, input().split())

last = first
ans = 1
for i in p:
    if i < last:
        ans += 1
        last = i

print(ans)

Solution (Python):
N=int(input())
P=list(map(int,input().split()))
count=0
minimum=max(P)
for i in range(N):
    if P[i]<=minimum:
        count+=1
        minimum=P[i]
print(count)

Solution (Python):
N = int(input())
p = list(map(int, input().split()))

max0, max1, count = p[0], 0, 0
for i in p:
    max0 = min(max0, i)
    max1 = i
    if max1 == 1:
        count += 1
        break
    elif max0 >= max1:
        count += 1
print(count)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
ans = 0
m = p[0]
for i in p:
    if i <= m:
        ans += 1
        m = i

        
        
print(ans)

Solution (Python):
n = int(input())
ppp = list(map(int, input().split()))
curr = 10 ** 9
ans = 0
for p in ppp:
    if p < curr:
        ans += 1
        curr = p
print(ans)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
min=200001
ans=0
for x in p:
  if min>x:
    min=x
    ans+=1
    if x==1:
      break

print(ans)

Solution (Python):
N = int(input())
P = list(map(int,input().split()))

cur_min = 10**15
res = 0
for i in P:
  if i < cur_min:
    cur_min = i
    res += 1

print(res)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))

temp_min = n + 1
m = 0
for i in range(n):
    if p[i] < temp_min:
        m += 1
        temp_min = p[i]
print(m)

Solution (Python):
import math
from collections import deque
from collections import defaultdict


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	
	ans = data[:]
	return ans

n = readInt()
p = readInts()

minV = p[0]
ans = 1

for i in range(1,n):
	if minV >= p[i]:
		minV = p[i]
		ans+=1

print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
ans = 0
INF = 2 * 10 ** 5 + 1
Q = [INF] * N
Q[0] = P[0]

for i in range(1, N):
    Q[i] = min(P[i], Q[i - 1])

for i in range(N):
    if P[i] <= Q[i]:
        ans += 1

print(ans)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    p = [int(i) for i in input().split()]
    min_ = p[0]
    cnt = 0
    for i in range(n):
        if p[i] <= min_:
            min_ = p[i]
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
p = list(map(int, input().split()))

max_n = p[0]
min_n = p[0]
ans = 1

for i in range(1, N):
    
    if min_n >= p[i]:
        ans += 1
        min_n = p[i]
    
        

print(ans)

Solution (Python):
N=int(input())
P=input().split()
Pn=[]
Pn.append(int(P[0]))

count=1
nowmin=Pn[0]

for i in range(1,len(P)):
    if int(P[i])<nowmin:
        count+=1
        nowmin = int(P[i])
    
print(count)

Solution (Python):
N=int(input())
S=list(map(int,input().split()))

first=S[0]
count=1
nagasa=len(S)

for i in range(1,nagasa):
    if S[i]<first:
        count+=1
        first=S[i]
        
print(count)

Solution (Python):
N = int(input())
Pn = list(map(int, input().split()))
t = float("inf")
result = 0
for p in Pn:
    if t > p:
        result += 1
    t = min(t, p)
print(result)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=2*10**5
cnt=0
for i in a:
  if b>=i:
    cnt+=1
    b=i

print(cnt)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
check=n
ans=0
for i in range(n):
  if p[i]<=check:
    check=p[i]
    ans=ans+1
print(ans)

Solution (Python):
n  = int(input())
a = list(map(int, input().split()))

count = 0
m = a[0]
for i in range(n):
    if a[i]  <= m:
        m = a[i]
        count += 1
print(count)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
count = 0
s = p[0]
for i in range(1, n+1):
    s = min(s, p[i-1])
    if (s == p[i-1]):
        count += 1
print(count)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
min = pow(10, 6)
ans = 0

for num in p:
    if num <= min:
        ans += 1
        min = num

print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
count = 0
mini = P[0]
for p in P:
    if p <= mini:
        count += 1
    mini = min(mini, p)
print(count)

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())

p = list(map(int, input().split()))

m = p[0]

l = []

for x in p:
    m = min(m, x)
    l.append(m)

s = 0

for i in range(n):
    if p[i] == l[i]:
        s += 1

print(s)

Solution (Python):
N = int(input())
P = [int(i) for i in input().split()]

ans = 1
t = N
for i in range(N - 1):
    t = min(t, P[i])
    if t > P[i + 1]:
        ans += 1
print(ans)

Solution (Python):
n = int(input())
li = list(map(int, input().split()))
ans = 0;

min_val = 1e+8
for i in li:
    if i <= min_val:
        ans += 1
        min_val = i

print(ans)

Solution (Python):
n = int(input())
p = [int(x) for x in input().split()]


ans = 1
base = p[0]

for i in range(1, n):
    if p[i] < base:
        ans += 1
        
        base = p[i]

print(ans)

Solution (Python):
N = int(input())
P = list(map(int,input().split()))
ans = 0
min_ = P[0]
for i in range(N):
    if min_ >= P[i]:
        ans += 1
        min_ = P[i]
print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
ans = 1
min_num = P[0]
for n in P:
    if n < min_num:
        min_num = n
        ans += 1
print(ans)

Solution (Python):
N = int(input())

P = list(map(int,input().split()))

result = 0
current_min = 10**6
for i in range(N):
    current_min = min(current_min, P[i])
    if P[i] <= current_min:
        result += 1

print(result)

Solution (Python):
N=int(input())
ans=0
champ=10**6
for p in list(map(int,input().split())):
    if p<champ:
        ans+=1
        champ=p

print(ans)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))

num = n + 1
res = 0
for v in p:
  if num > v:
    res += 1
    num = v

print(res)

Solution (Python):
import math

N = int(input())

tmp = 10 ** 30
ans = 0
for P in list(map(int,input().split())):
    if P <= tmp:
        tmp = P
        ans += 1

print(ans)

Solution (Python):

n = int(input())
a = [int(i) for i in input().split()]
ans = 1
nowmin = a[0]


if n != 1:
  for i in range(1, n):
    if a[i] < nowmin:
      ans += 1
      nowmin = a[i]
    if nowmin == 1:
      break


print(ans)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))

ans = 1
min_p = p[0]

for i in range(1,n):
    if p[i] < min_p:
        ans += 1
        min_p = p[i]
    else:
        pass

print(ans)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
cnt=0
s=float('inf')
for i in p:
  s=min(s,i)
  if s==i:
    cnt+=1
  
    
print(cnt)

Solution (Python):
N = int(input())
Ps = list(map(int, input().split()))

answer = 0
min_num = 2 * 10 ** 5 + 1
for p in Ps:
    min_num = min(p, min_num)
    if min_num >= p:
        answer = answer + 1

print(answer)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,  *p = map(int, read().split())

i_min = float('inf')
ans = 0
for x in p:
    if x <= i_min:
        ans += 1
        i_min = x
print(ans)

Solution (Python):
n = int(input())
ls = list(map(int,input().split()))
min = ls[0]
k = 1
for i in range(1,n):
    if ls[i] < min:
        min = ls[i]
        k += 1
print(k)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
q=2*10**5+1
cnt=0
for i in range(n):
  if q>=p[i]:
    cnt+=1
    q=p[i]
print(cnt)

Solution (Python):
N=int(input())
P=[int(p) for p in input().split()]
cnt=1
min=P[0]
for i in range(1,N):
    if P[i]<min:
        min=P[i]
        cnt+=1
    else:
        pass
print(cnt)

Solution (Python):
def main():
    N = int(input())
    P = list(map(int, input().split()))
    minp = N+1; cnt = 0
    for p in P:
        minp = min(minp, p)
        if minp < p:
            cnt += 1
    print(N-cnt)

if __name__ == "__main__":
    main()

Solution (Python):


def solve(N, Ps):
    ans = 0
    target = Ps[0]
    for p in Ps:
        if p <= target:
            ans += 1
            target = p
    print(ans)


if __name__ == '__main__':
    N = int(input())
    Ps = [int(i) for i in input().split()]
    solve(N, Ps)

Solution (Python):
N = int(input())

P = list(map(int, input().split()))

l= [P[0]]
n = P[0]
for i in range(1,N):
  if n >= P[i]:
    l.append(P[i])
    n = P[i]

print(len(l))

Solution (Python):
N = int(input())
P = list(map(int,input().split()))
m = N + 1
ans = 0
for i in P:
  if i <= m:
    ans += 1
    m = i
  else:
    continue
print(ans)

Solution (Python):
N = int(input())
P = list(map(int,input().split()))

a = P[0]
ans = 0

for i in range(N):
  if P[i] <= a:
    a = P[i]
    ans += 1
    
print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))

min_tmp = N+1
ans = 0

for p in P:
    if min_tmp >= p:
        ans += 1
        min_tmp = p
    else:
        continue

print(ans)

Solution (Python):
n = int(input())
p = [int(i) for i in input().split()]

cnt = 1
m = p[0]
for i in range(1,n):
	if m > p[i-1]:
		m = p[i-1]
	if m >= p[i]:
		cnt += 1
	
	
print(cnt)

Solution (Python):
N = int(input())
P = list(map(int,input().split()))
minimam = P[0]
answer = 0

for i in range(N):
    if minimam >= P[i]:
        answer += 1
        minimam = P[i]
print(answer)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
min = float('inf')
ans = 0

for i in p:
    if i <= min:
        min = i; ans += 1

print(ans)

Solution (Python):
N=int(input())
P=list(map(int,input().split()))
count,minimum=0,max(P)
for i in range(N):
    if P[i]<=minimum:
        count+=1
        minimum=P[i]
print(count)

Solution (Python):

N=int(input())
P=[int(x) for x in input().split()]

MIN=N+1
ans=0
for i in range(N):
    if MIN>P[i]:
        ans+=1
    MIN=min(MIN,P[i])
print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))

tmp = P[0]
ans = 0

for i in P:
    if i <= tmp:
        ans += 1
        tmp = i
        
print(ans)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
ans=1
small=p[0]
for i in range(1,len(p)):
    if p[i] <= small :
        ans+=1
        small=p[i]
print(ans)

Solution (Python):
N=int(input())
P=list(map(int,input().split()))
ans=0
tmp=2*10**5+1
for i in range(N):
  if P[i]<=tmp:
    ans+=1
    tmp=P[i]
print(ans)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in p:
  if i <= p[0]:
    p[0] = i
    ans += 1
print(ans)

Solution (Python):
mina=10**11
c=0
N=int(input())
L=list(map(int,input().split()))
for i in range(N):
  mina=min(mina,L[i])
  if mina==L[i]:
    c=c+1
print(c)

Solution (Python):
def main():
    n = int(input())
    P = list(map(int, input().split()))
    m = float('inf')
    cnt = 0
    for i in range(n):
        if P[i] < m:
            cnt += 1
            m = P[i]
    print(cnt)

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    P = list(map(int, input().split()))
    m = float('inf')
    cnt = 0
    for i in range(n):
        if P[i] < m:
            cnt += 1
            m = P[i]
    print(cnt)

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
p = [int(x) for x in input().split()]
mini = n + 1
ans = 0
for i in range(n):
    ans += p[i] < mini
    mini = min(mini, p[i])
print(ans)

Solution (Python):
N = int(input())
P = list(input().split())
P = [int(P[i]) for i in range(N)]
MIN = float('inf')
count = 0

for i in range(N):
    if P[i] < MIN:
        MIN = P[i]
        count += 1

print(count)

Solution (Python):


def main():
    N = int(input())
    P = list(map(int, input().split()))
    min_val = 10 ** 6
    ans = 0
    for p in P:
        if p < min_val:
            ans += 1
        min_val = min(min_val, p)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
a = p[0]
count = 0
for i in p:
    if i <= a:
        a = i
        count += 1
print(count)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
INF = float("inf")
mini = INF
cnt = 0
for i in range(n):
    if mini>=p[i]:
        cnt += 1
        mini = p[i]
print(cnt)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
INF = float("inf")
mini = INF
cnt = 0
for i in range(n):
    if mini>=p[i]:
        cnt += 1
        mini = p[i]
print(cnt)

Solution (Python):
N = int(input())
P = [int(i) for i in input().split()]

mi = 1000000
cnt = 0
for i in range(N):
	mi = min(P[i],mi)
	if P[i] <= mi:
		cnt += 1
print(cnt)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))




m = [0] * n
m[0] = p[0]

for i in range(1,n):
  m[i] = min(m[i-1],p[i])



ans = 0
for i in range(n):
  if m[i] >= p[i]:
    ans += 1

print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
 
tmpmin=n
ans=0
for val in a:
  if val<=tmpmin:
    ans+=1
    tmpmin=val
print(ans)

Solution (Python):
n  =int(input())
lis = list(map(int, input().split()))

total = 0
mini = lis[0]
for i in range(n):
    mini = min(mini, lis[i])
    if mini == lis[i]:
        total += 1
    
print(total)

Solution (Python):
n=int(input())
ct=0
p=list(map(int,input().split()))
mn=p[0]
for i in range(1,n):
    if mn>=p[i]:
        ct+=1
        mn=p[i]
print(ct+1)

Solution (Python):
n = int(input())
P = list(map(int, input().split()))

ans = 0
min_p = P[0]
for p in P:
    if p <= min_p:
        ans += 1
        min_p = p

print(ans)

Solution (Python):
n = int(input())
P = list(map(int, input().split()))

ans = 0
min_p = P[0]
for p in P:
    if p <= min_p:
        ans += 1
        min_p = min(min_p, p)

print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
min_value = P[0]
count = 1
for p in P[1:]:
    if min_value > p:
        count += 1
    min_value = min(p, min_value)
print(count)

Solution (Python):

class abc_152:
    
    def __init__(self):
        pass
    def A(self):
        pass
    def B(self):
        pass
    def C(self):
        N=int(input())
        P=list(map(int,input().split()))
        ans_count=0
        min_p=P[0]
        
        for i in range(N):
            if P[i]<=min_p:
                ans_count+=1
                min_p=P[i]
            else:continue
        print(ans_count)
        
    def D(self):
        pass
    def E(self):
        pass
    def F(self):
        pass
    
if __name__=='__main__':
    obj=abc_152()
    obj.C()

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
m = p[0]
ans=1
for i in p[1:]:
    if m>i:
        ans+=1
        m=i
print(ans)