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):



N = int(input())



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




min = 999999999
cnt = 0
for i in P:
    if min >= i:
        cnt += 1
        min = i

print(cnt)

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

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

print(ans)

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

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

ans = 1
tmp_min = p[0]

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

print(ans)

Solution (Python):
def main():
    n = int(input())
    P = [int(x) for x in input().split()]
    minv = 2 * 10 ** 5 + 1
    cnt = 0
    for i in range(n):
        if minv > P[i]:
            minv = P[i]
            cnt += 1
    print(cnt)
    
if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
li = list(map(int, input().split()))
minL = 2 * (10**6)
count = 0
for l in li:
  if (minL >= l):
    count += 1
    minL = l
print(count)

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

    mi = N + 1
    ret = 0
    for x in P:
        if mi > x:
            mi = x
            ret += 1

    print(ret)


if __name__ == '__main__':
    main()

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

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

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

tmp_min = p[0]
cnt = 0

for i in range(n):
    if p[i] <= tmp_min:
        tmp_min = p[i] 
        cnt += 1

print(cnt)

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

ans = [0]*N
min_cal = [0]*N
min_cal[0] = P[0]

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

for i in range(N):
  if min_cal[i] >= P[i]:
    ans[i] = 1

print(sum(ans))

Solution (Python):
n,*p=map(int,open(0).read().split())
c=0
min_p=p[0]
for i in range(n):
    min_p=min(min_p,p[i])
    if p[i]<=min_p:
        c+=1
print(c)

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

if n==1:
  print(1)
  
else:
  min1=a[0]
  ans=1
  for x in range(1,n):
    if min1>=a[x]:
      ans+=1
    min1=min(min1,a[x])
    
  print(ans)

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

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
p=lmp()
ans=0
m=2*n
for i in range(n):
    if p[i]<=m:
        ans+=1
        m=p[i]
print(ans)

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

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

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

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

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

Q = []
for i in range(N):
    if i == 0:
        Q.append(P[i])
    else:
        Q.append(min(Q[-1], P[i]))

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

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

Solution (Python):
N = int(input())
P = list(map(int,input().split()))
P = sorted([(P[i],i) for i in range(N)],key=lambda x:x[0])
cnt = 1
imin = P[0][1]
for i in range(1,N):
    ind = P[i][1]
    if ind<imin:
        cnt += 1
        imin = ind
print(cnt)

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

  print(ans)
  return

if __name__ == "__main__":
  resolve()

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ps = list(mapint())

m = 10**18
ans = 0
for p in Ps:
    if p<=m:
        ans += 1
        m = p

print(ans)

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

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

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

M = N+1
cnt = 0
for p in P:
    if p < M:
        cnt += 1
        M = p

print(cnt)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n = ini()
p = inl()


def solve():
    ans = 1
    m = p[0]
    for i in range(1, n):
        if p[i] <= m:
            ans += 1
        m = min(m, p[i])
    return ans


print(solve())

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

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

Solution (Python):
N = int(input())
P = input().split(' ')
P = [int(P[i]) for i in range(N)]
count = 0
PS = []
min = 2*10**5+1
for i in range(N):
  p = P[i]
  if p<=min:
    min = p
    count += 1
print(count)

Solution (Python):
from collections import Counter, defaultdict
import sys

sys.setrecursionlimit(10 ** 5 + 10)

from math import factorial
import heapq, bisect
import math
import itertools
from copy import deepcopy
import queue
from collections import deque





def main():
    num = int(input())
    data = list(map(int, input().split()))

    now_num = 10 ** 10
    ans = 0

    for i in range(num):
        if data[i] < now_num:
            now_num = data[i]
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

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

minimum = 2e6
ans = 0

for p in P:
    if p <= minimum:
        minimum = p
        ans += 1

print(ans)

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

print(ans)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
m = n
q = 2 * (10 ** 5)

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

print(m)

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
mi = n+2
ans = 0
for i in a:
   if mi > i:
      ans+=1
      
   mi=min(i,mi)

print(ans)

Solution (Python):
n=int(input())
L=list(map(int,input().split()))
ans=0
Min=2*10**5+1
for i in L:
    if i<Min:
        ans+=1
        Min=i
print(ans)

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

Solution (Python):
N = int(input())
P = list(map(int,input().split()))
mini = N+1
cnt = 0
for i in P:
  if mini > i:
    cnt += 1
    mini = i
print(cnt)

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

ans = 1
b = c[0]

for i in range(1,n):
    if b >=c[i]:
        b = c[i]
        ans +=1
    else:
        pass

print(ans)

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

INF = 10 ** 18
A = [0] * N
mn = INF
for i, p in enumerate(P):
    if p < mn:
        mn = p
        A[i] = p
    else:
        A[i] = mn

ans = 0
for i, p in enumerate(P):
    if A[i] >= p:
        ans += 1
print(ans)

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

Solution (Python):

import math
N = int(input())
p = list(map(int,input().split()))

cou = 0
x = math.inf

for j in range(N):
    if min(x,p[j]) == p[j]:
        x = p[j]
        cou += 1

print(cou)

Solution (Python):
n=int(input(""))
pp=input("").split(" ")
latest=n
s=0
for i in range(n):
    tmp=int(pp[i])
    if (tmp<=latest):
        latest=tmp
        s+=1

print(s)

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

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

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

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

Solution (Python):
n = int(input())
p = [220000] + list(map(int, input().split()))

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

Solution (Python):
N = int(input())
P = [220000] + list(map(int, input().split()))
cnt = 0
m = 220000
for i in range(1, N+1):
    now = P[i]
    m = min(m, now)
    if now == m:
        cnt += 1

print(cnt)

Solution (Python):
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N = II()
    P = LI()
    ans = 0
    min = N+1

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

    print(ans)

if __name__ == "__main__":
	main()

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

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

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

Solution (Python):
n=int(input(''))
p=list(map(int,input('').split(' ')))
s=1
mi=p[0]
for a in range(n-1):
    if p[a+1]<=mi:
        s=s+1
        mi=p[a+1]

print(s)

Solution (Python):
def main():
    n = int(input())
    p = [int(i) for i in input().split()]
    Min = [10**9]
    ans = 0
    for i in range(n):
        Min.append(min(Min[-1],p[i]))
    for i in range(n):
        if Min[i]>p[i]:
            ans += 1
    print(ans)
main()

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

m = b[0]
n = 0
for i in range(0,a):
    if m >= b[i]:
        m = b[i]
        n = n + 1
print(n)

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

count = 0
m = p[0]

for i in p:
    m = min(m, i)
    if m == i:
        count += 1
print(count)

Solution (Python):
N = int(input())
x = 200_001
P = list(map(int, input().split()))
cnt = 0
for p in P:
    if p < x:
        cnt += 1
        x = p
print(cnt)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
m = A[0]
ans = 0
for a in A:
  m = min(m, a)
  if m == a:
    ans += 1
print(ans)

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

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

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

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

n, s, c = int(input()), list(map(int, input().split())), 0
m = s[0]
for i in range(n):
	if s[i] <= m: m = s[i]; c += 1
print(c)

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

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

ans = 0
prev_min = P[0]
for p in P:
    if prev_min >= p:
        ans += 1
        prev_min = p
print(ans)

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

last_ok_postion = 0 
count = 1

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

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

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

c = 1
min = p[0]
for i in range(1,n) :
    if min >= p[i] :
        c += 1
        min = p[i]

print(c)

Solution (Python):
n, *aa = map(int, open(0).read().split())

bb = []

tmp = aa[0]
for a in aa:
    tmp = min(a,tmp)
    bb.append(tmp)



print(sum([a<=b for a, b in zip(aa, bb)]))

Solution (Python):
N = int(input())
P = list(map(int,input().split()))
mini = 10000000000000
ansL = [0]*N


for i in range(N):
    if P[i] <= mini:
        ansL[i] = 1
        mini = P[i]

print(ansL.count(1))

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

ans = 0
n = P[0]

for i in P:
    if n >= i:
        ans += 1
        n = i

print(ans)

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

for i in p:
    if i <= min_p:
        min_p = i
        ans += 1

print(ans)

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

ans = 0
min_p = P[0]

for p in P:
    if min_p >= p:
        min_p = p
        ans += 1

print(ans)

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

Min = float('inf')
cnt = 0
for i in range(N):
    if P[i] <= Min:
        cnt += 1
        Min = P[i]

print(cnt)

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

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

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

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

Solution (Python):
N = int(input())
A = list([int(x) for x in input().split()])
count = 0

min_a = N+1

for a in A:
    if a == min(min_a, a):
        count += 1
        min_a = a

print(count)

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

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

  minP = 1000000000000000000000
  cnt = 0
  
  for i in range(N):
    if P[i] <= minP:
      minP = P[i]
      cnt += 1
  
  print(cnt)
  
  
  
main()

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

print(ans)

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

print(count)

Solution (Python):

n,*p=map(int,open(0).read().split())
c=0
n+=1
for i in p:
    n = min(n, i)
    if i<=n:
        c+=1
print(c)

Solution (Python):
def main():
    N = int(input())
    P = [0] + list(map(int, input().split()))
    L = [0]*(N+1)
    cnt = 0
    mi = 10**10
    for i in range(1,N+1):
        mi = min(mi,P[i])
        if mi == P[i]:
            cnt+=1

    print(cnt)




if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

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

print(ans)

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

Solution (Python):


import copy
import random
import bisect 
import fractions 
import math
import sys
import collections
from decimal import Decimal 

mod = 10**9+7
sys.setrecursionlimit(mod) 

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))
N = int(input())

p = LI()

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


print(ans)

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

Solution (Python):
n=int(input())
arr=list(map(int, input().rstrip().split()))
mina=10**6
ans=0
for a in arr:
  mina=min(a,mina)
  if a <= mina:
    ans+=1
print(ans)

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

print(c)

Solution (Python):


import io
import sys
import math

def solve(n, p_lst):
    
    xmin = p_lst[0]
    cnt = 0
    for x in p_lst:
        if x <= xmin:
            cnt+=1
            xmin = x
            if xmin == 1:
                break
    return cnt

def main():
    
    n = int(input())
    p_lst = list(map(int, input().split()))
    
    
    ans = str( solve(n, p_lst ) )
    
    
    print(ans)
    return ans
        

_DEB = 0   

_INPUT = """\
1
1
"""
_EXPECTED = """\
3
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")


if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Solution (Python):


import io
import sys
import math

def solve(n, p_lst):
    
    xmin = p_lst[0]
    cnt = 0
    for x in p_lst:
        if x <= xmin:
            cnt+=1
            xmin = x
    return cnt

def main():
    
    n = int(input())
    p_lst = list(map(int, input().split()))
    
    
    ans = str( solve(n, p_lst ) )
    
    
    print(ans)
    return ans
        

_DEB = 0   

_INPUT = """\
1
1
"""
_EXPECTED = """\
3
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")


if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Solution (Python):
N = int(input())
P_s = list(map(int, input().split()))
MIN = 10**10
answer = 0
for P in P_s:
    if MIN >= P:
        MIN = P
        answer += 1
print(answer)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Solution (Python):
N = int(input())
Pmin = 200000
count = 0
for P in input().split():
    P = int(P)
    if P <= Pmin:
        count += 1
        Pmin = P
print(count)

Solution (Python):
n = int(input())
p_li = [int(w) for w in input().split()]

ans = 0
used_min = 2000000

for p in p_li:
    if p <= used_min:
        ans += 1
        used_min = p

print(ans)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *P = map(int, read().split())

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
_ = int(input())
lp = list(map(int, input().split()))

m = 10 ** 6
answer = 0
for p in lp:
    m = min(m, p)
    answer += int(p <= m)

print(answer)

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

M=N+1
K=0
for a in P:
    if a<=M:
        M=a
        K+=1
print(K)

Solution (Python):
n = int(input())
lst = list(map(int, input().split()))
nowmin = 10 ** 9
res = 0
for i in range(n):
  if nowmin >= lst[i]:
    res += 1
    nowmin = lst[i]
print(res)

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

ans=0
mini=n+1

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

print(ans)

Solution (Python):
N=int(input())
A = list(map(int, input().split()))
comp=N
ans=0

for i in range(N):
  if min(comp, A[i])==A[i]:
    ans+=1
    comp=A[i]
print(ans)

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

    
if __name__ == "__main__":
    main()

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

mi = 10 ** 6
cnt = 0

for a in A:
    mi = min(mi, a)
    if a == mi:
        cnt += 1
print(cnt)

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

for i in A:
  if i <= min_A:
    min_A = i
    ans += 1

print(ans)

Solution (Python):
N=int(input())
P=[int(x) for x in input().split()]
M=P[0]
count=0
for i in range(N):
  if P[i]<=M:
    count=count+1
    M=min(M,P[i])
print(count)

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

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = N + 1
for p in P:
    if res < p:
        continue
    cnt += 1
    res = min(res, p)
print(cnt)

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

count = 0
m = p[0]

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

print(count)

Solution (Python):









import os
import sys
import numpy as np



def main():
    n = int(input())
    p = list(map(int, input().split()))
    cnt = 1
    p_min = p[0]
    for i in range(1, n):
        if p_min > p[i]:
            cnt += 1
            p_min = p[i]

    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
cnt = 1
min = A[0]
for a in A:
  if min > a:
    cnt += 1
    min = a
print(cnt)

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

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

Solution (Python):









import sys
input = sys.stdin.readline

N = int(input())
P = list(map(int, input().split()))
Pmin = [2*10**5 for i in range(N)]
Pmin[0] = P[0]
for i in range(1, N):
    Pmin[i] = min(Pmin[i-1], P[i])

ans = 0
for i in range(N):
    if Pmin[i] >= P[i]:
        ans += 1

print(ans)

Solution (Python):
import sys












stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    N = int(stdin.readline().rstrip())
    
    P = list(map(int, stdin.readline().rstrip().split()))
    
    
    
    
    mini = [IINF]
    for i in range(N):
        mini.append(min(mini[-1],P[i]))
    ans = 0
    for i in range(N):
        if mini[i+1] == P[i]:
            ans += 1
    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
import copy

N = int(input())
P = [int(x) for x in input().split()]
mano = []
min = N+1
for i in range(N):
    if P[i] < min:
        min = P[i]
    mano.append(min)

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

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

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

cnt = 1
min_num = P[0]

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

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

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

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

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

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

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

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

Solution (Python):
n = int(input())
import sys
pn = list(map(int, sys.stdin.readline().split()))

ans = 1
mini = pn[0]

for i in range(1, n):
    mini = min(mini, pn[i])
    if mini==pn[i]:
        ans += 1

print(ans)

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

Solution (Python):
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

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

    min_p = 1_000_000_000
    count = 0
    for p in P:
        if p < min_p:
            count += 1
            min_p = p
    
    print(count)

main()

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
Q = [P[0]]
for i in P[1:]:
    if i < Q[-1]:
        Q.append(i)
print(len(Q))

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

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

print(count)

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

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

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

min=p[0]
ans=0

for i,v in enumerate(p):
	if min>=v:
		min=v
		ans+=1


print(ans)

Solution (Python):
n=int(input())
p=list(map(int,input().split()))
tmp=float("inf")
ans=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()))

cnt = 0
mi = n + 1
for i in range(n):
    mi = min(mi,p[i])
    
    if p[i] == mi:
        cnt += 1

print(cnt)

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

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

cnt = 0
mi = n + 1
for i in range(n):
    mi = min(mi,p[i])
    
    if p[i] == mi:
        cnt += 1

print(cnt)

Solution (Python):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

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

q_list = np.minimum.accumulate(p_list)
ans = np.count_nonzero(q_list == p_list)

print(ans)

Solution (Python):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7

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

ans = 0
temp_min = MOD
for i in p_list:
    if i <= temp_min:
        temp_min = i
        ans += 1

print(ans)

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

minimum = N + 1
ans = 0

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

print(ans)

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

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

ans = 0
minP = N+1
for P in Ps:
    if minP >= P:
        ans += 1
        minP = P

print(ans)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
ans=1 ; minn=a[0]
for i in range(1,n):
    if a[i]<=minn:
        ans+=1
        minn=a[i]
print(ans)

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

min = p[0]
count = 0

for i in range(n):
    if min >= p[i]:
        count += 1
        min = p[i]

print(count)

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

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