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):
a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)

Solution (Python):



from collections import deque

N = int(input())
P = deque(list(map(int, input().split())))
ans, tmp, minnum = 0, 0, pow(10,9)
Array = []

for i in range(N):
    tmp = P.popleft()
    Array.append(tmp)
    if tmp < minnum:
        minnum = tmp
    if Array[-1] == minnum:
        ans += 1
print(ans)

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

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

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

print (cnt)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
ans = 0
min_here = 3 * 10 ** 5
for ele in arr:
    if min_here > ele:
        ans += 1
    min_here = min(min_here, ele)
print(ans)

Solution (Python):

from sys import stdin




def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


N = _i()
p_list = _li()

cur_min = 10**7
count = 0
for p in p_list:
    if p <= cur_min:
        count += 1
    if p < cur_min:
        cur_min = p
print(count)

Solution (Python):
"""
can do it by subproblems. for a given i, the only information you need from the previous values
is the min value of previous values.
the first i=0 is guaranteed to satisfy the constraint. (counting from zero).
"""
import sys


def count_low_elements(N, P):
    count = 0
    min_so_far = sys.maxsize
    for val in P:
        if val <= min_so_far:
            count += 1
            min_so_far = val
    return count


if __name__ == "__main__":
    test1 = \
"""5
4 2 5 1 3"""
    test2 = \
"""4
4 3 2 1"""
    test3 = \
"""6
1 2 3 4 5 6"""
    test4 = \
"""8
5 7 4 2 6 8 1 3"""
    test5 = \
"""1
1"""
    test = test5
    
    
    N = int(input())
    P = list(map(int, input().split()))
    print(count_low_elements(N, P))

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
ans=0
prev=float('inf')
for l in L:
  if l<prev:
    ans+=1
    prev=l
  else:
    continue
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
def solve():
  n = int(input())
  p = list(int(i) for i in input().split())
  now = n+1
  times = 0
  for i in range(n):
    value = p[i]
    if now >= value:
      times += 1
    now = min(value,now)
  print(times)
    
solve()

Solution (Python):
n = input()
arr = [int(x) for x in input().split()]
min_num = arr[0]
i = 0
for x in arr:
  if x <= min_num:
    i += 1
    min_num = x
print(i)

Solution (Python):
N = int(input())
lst1 = [int(x) for x in input().split()]
a = lst1[0]
ret = 0
for x in lst1:
    a = min(a, x)
    if x <= a:
        ret += 1
print(ret)

Solution (Python):
N = int(input())
p = list(map(int, input().split()))
count = 0
min = p[0]

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

print(count)

Solution (Python):
N = int(input())
p = [int(e) for e in input().split(" ")]
low = p[0]
c = 0
for i in range(N):
    if(p[i] <= low):
        c += 1
        low = p[i]
print(c)

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

print(count)

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

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

minv = float('inf')
cnt = 0
for v in a:
    if minv > v:
        minv = v
        cnt += 1
print(cnt)

Solution (Python):
i = int(input())
j = [int(x) for x in input().split()]

m = j[0]
count = 0
for x in range(i):
    if m >= j[x]:
        count += 1
        m = j[x]
print(count)

Solution (Python):

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

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

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

min = Pn[0]
count = 0


Pn = Pn[:Pn.index(1)+1]

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

print(count)

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True, end="")

N = _I()
X=LI()
ans=0

lowest=X[0]
for x in X:
	if x <= lowest:
		ans+=1
		lowest=x
print(ans)

Solution (Python):
import sys
N = int(sys.stdin.readline())
nums = [int(x) for x in sys.stdin.readline().split()]
 
ans = 0
_min = float('inf')
for num in nums:
  if _min >= num:
    ans += 1
  _min = min(_min, num)
print(ans)

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

Solution (Python):
n = int(input())
mini = n + 1
count = 0
for p in map(int, input().split()):
  if p < mini:
    count += 1
    mini = p
print(count)

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

Solution (Python):
import sys
from operator import itemgetter
import collections

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

def main():
    input = sys.stdin.readline
    n = int(input())
    p = list(map(int, input().split()))
    print(r(n,p))

    
if __name__ == '__main__':
    main()

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

cnt = 0
pjmin = P[0]
for pi in P:
    if pi <= pjmin:
        cnt +=1
        pjmin = pi
        if pi ==1:
            break
print(cnt)

Solution (Python):
def f(L):
    a=len(L)
    b=L[0]
    c=0
    for i in range(len(L)):
        if L[i]<b:
            b=L[i]
        if b==L[i]:
            c+=1
    return c
a=int(input())
L=list(map(int,input().split()))
print(f(L))

Solution (Python):
def main():
    N = int( input())
    P = list( map( int, input().split()))
    ans = 0
    now = P[0]
    for p in P:
        if now >= p:
            ans += 1
            now = p
    print(ans)
if __name__ == '__main__':
    main()

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

min_ = float("inf")
c = 0
for i in range(n):
    if A[i] < min_:
        min_ = A[i]
        c += 1
print(c)

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

min_value = P[0]
ans_count = 0
for i in range(len(P)):
    if P[i] <= min_value:
        ans_count += 1

    min_value = min(min_value, P[i])

print(ans_count)

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

count = 0
min_p = N + 1
for p in P:
    min_p = min(min_p, p)
    if p <= min_p:
        count += 1

print(count)

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

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
ans = 0
min=2*100000

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

print(ans)

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

Solution (Python):
def solve(n, P):
    min_val = P.pop(0)
    count = 1
    for p in P:
        if min_val >= p:
            count += 1
        if min_val > p:
            min_val = p
    return count

_n = int(input())
_P = list(map(int, input().split()))
print(solve(_n, _P))

Solution (Python):
def resolve():
    N = int(input())
    arr = tuple(map(int, input().split()))
    tmp = arr[0]
    counter = 0
    for i in arr:
        if i<=tmp:
            tmp=i
            counter += 1
    print(counter)
 
if __name__ == "__main__":
    resolve()

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

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

print(ans)

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


c = 1
min = P[0]

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

Solution (Python):
import sys
lines = [l.rstrip() for l in sys.stdin.readlines()]
n = int(lines[0])
l = [int(e) for e in lines[1].split(" ")]

min = n
c = 0
for e in l:
    if e < min:
        min = e
    if min >= e:
        c += 1

print(c)

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

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

flag = True
pre_min_p = p[0]
cnt = 0
for i in p:
    if pre_min_p >= i:
        cnt += 1
        pre_min_p = i

print(cnt)

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

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
count = 0
min = p[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()))
min = p[0]
count=0
for i in range(n):
  if p[i] <= min:
    min = p[i]
    count += 1
print(count)

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

q = p[0]
p = p[1:]

m = 1

if n > 1:
    for pi in p:
        if q > pi:
            m += 1
            q = pi

print(m)

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

cnt=0
mi=P[0]

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

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

count = 1
min = P_list[0]
for i in range(1, len(P_list)):
    if P_list[i] <= min:
        count += 1
        min = P_list[i]
print(count)

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

ans = 0
now = 10 ** 6

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

print(ans)

Solution (Python):
a=int(input())
lis=list(map(int,input().split()))
min=float('inf')
ans=0
for i in lis:
  if min>=i:
    ans+=1
    min=i
print(ans)

Solution (Python):
def solve(n, P):
  min_val = P.pop(0)
  count = 1
  for p in P:
    if min_val >= p:
      count += 1
    if min_val > p:
      min_val = p
  return count

_n = int(input())
_P = list(map(int, input().split()))
print(solve(_n, _P))

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

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

Solution (Python):

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

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

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

Solution (Python):
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 = min(p[i], num)

print(ans)

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

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

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

count = 0
m = N
for p in P:
  m = min(m, p)
  if p <= m:
    count += 1
print(count)

Solution (Python):
N = int(input())
li = [int(zz) for zz in input().split()]

ans = 0
tmp = 10**9
for i in range(N):
    if li[i] < tmp:
        tmp = li[i]
        ans += 1

print(ans)

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

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

counter = 0

min = Pn[0]

for i in range(N):
  if Pn[i] <= min:
    counter += 1
    min = Pn[i]
  else:
    pass

print(counter)

Solution (Python):
n = int(input())
data = [int(i) for i in input().split()]
pre = data[0]
ans = 0

for now in data:
  if now <= pre:
    pre = now
    ans += 1
    
print(ans)

Solution (Python):
n = int(input())
seq = [int(e) for e in input().split(' ')]

count = 1

current_min = seq[0]

for idx, i in enumerate(seq[1:]):
  if i < current_min:
    current_min = i
    count += 1
print(count)

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

min = 0
cnt = 0
for i in range(N):
  if i == 0:
    cnt += 1
    min = A[i]
    continue
  if A[i] <= min:
    cnt += 1
    min = A[i]

print(cnt)

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

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

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

mi = 2 * 10 ** 5 + 1
ans = 0
for i in range(n):
    if p[i] <= mi:
        mi = p[i]
        ans += 1

print(ans)

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

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

print(ans)

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

maxs = 1000000000000
cnt = 0
for i, s in enumerate(S):
  if maxs > s:
    cnt += 1
    maxs = s
    
print(cnt)

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

count = 0

minimum = Ps[0]

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

print(count)

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

ac = list(itertools.accumulate(P, min))
ok = [P[i] <= ac[i] for i in range(len(P))]
print(ok.count(True))

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

Solution (Python):

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


import heapq as hp
Q = []
answer = 0
for i in range(N):
    hp.heappush(Q, P[i])
    temp = hp.heappop(Q)
    hp.heappush(Q, temp)
    if temp == P[i]:
        answer += 1

print(answer)

Solution (Python):
n = int(input())
low = 0
lowest_seen = n + 1
for i in input().split():
    i = int(i)
    if i < lowest_seen:
        lowest_seen = i
        low += 1

print(low)

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

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

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

Solution (Python):
input_N = int(input())
p_list = list(map(int, input().split()))

cnt =1
for i in range(input_N-1):
    if p_list[i] > p_list[i+1]:
        cnt += 1
    else:


        p_list[i+1] = p_list[i]
        
print(cnt)

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

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

count = 0
pre = p[0]
for now in p:
    if now <=pre:
        count+=1
        pre = now
print(count)

Solution (Python):
N = int(input())
P = map(int, input().split(' '))
r = 0
min = 999999
for p in P:
    if p < min:
        r += 1
        min = p
print(r)

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

result_sum = 0
prev_min = 10  ** 9
for i in range(iterate):
  if p[i] <= prev_min:
    	result_sum += 1
  prev_min = min(prev_min, p[i])

print(result_sum)

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

ans=0
minCount=2*10**6

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

print(ans)

Solution (Python):

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

x = P[0]
ans = 0

for i , val in enumerate(P):
    if val <= x:
        x = val
        ans += 1
print(ans)

Solution (Python):
total = int(input())
array = list(map(int, input().split()))

min = 0
ans = 0
for i,num in enumerate(array):
    if i == 0:
        min = num
        ans += 1
    else:
        if num < min:
            min = num
            ans += 1

print(ans)

Solution (Python):

import sys


def solve(N: int, P: "List[int]"):
    smallest = 2 * 10**6
    count = 0
    for p in P:
        if p <= smallest:
            count += 1
            smallest = p
    print(count)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    P = [int(next(tokens)) for _ in range(N)]  
    solve(N, P)

if __name__ == '__main__':
    main()

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

answer = 0
mi = -1
for idx, p in enumerate(li_p):
    if idx == 0:
        mi = p
        answer += 1
    else:
        if p <= mi:
            answer += 1
        mi = min(mi, p)
print(answer)

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

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

cnt = 1
m = P[0]

for p in P[1:]:
    if m > p:
        cnt += 1
    m = min(m, p)
print(cnt)

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

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

print(ans)

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

min = 9999999
ans = 0

for x in p:
  if x <= min:
    ans = ans+1 
    min = x
  
print(ans)

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

Max = Num[0]
Min = Num[0]
cnt  = 1
for i in range(1,N):
    if Num[i] <= Max and  Min>=Num[i] :
        cnt +=1
        
    Max = max(Max,Num[i])
    Min = min(Min,Num[i])
    
print(cnt)

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
P = [int(_) for _ in stdin.readline().rstrip().split()]
max = P[0]
ans = 0
for p in P:
    if p <= max:
        ans += 1
        max = p
print(ans)

Solution (Python):
n = int(input())
l = map(int,input().split())
ans = 0
for i in (l):
    if n >= i:
        ans += 1
        n = i
print(ans)

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

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

min = 2*(10**5) + 1
cnt = 0

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

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

ans = 1
mi = row[0]

for i in range(1,N):
  if row[i] < mi :
    ans+=1
    mi = row[i]
  else :
    continue
    
print(ans)

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

Solution (Python):
N, *P = map(int, open(0).read().split())

ret = 0
min_value = float("inf")
for P_i in P:
  min_value = min(min_value, P_i)
  if min_value == P_i:
    ret += 1
    
print(ret)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
m = 10 ** 9 + 7
ret = 0
for i in range(N):
    m = min(m, P[i])
    if m == P[i]:
        ret += 1
print(ret)

Solution (Python):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
P = np.array(lr(), np.int32)
P_min = np.minimum.accumulate(P)

answer = np.count_nonzero(P_min >= P)
print(answer)

Solution (Python):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
P = np.array(lr())
P_min = np.minimum.accumulate(P)

answer = np.count_nonzero(P_min >= P)
print(answer)

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

numbers = [int(i) for i in input().split()]

cnt = 0
min_num = numbers[0]
for i, n in enumerate(numbers):
    if min_num >= n:
        cnt += 1
        min_num = n
    
    if n == 1:
        break
        
print(cnt)

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

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

Solution (Python):
input()
nums = map(int, input().split())
count = 0
min_sofar = float('inf')
for num in nums:
  if num <= min_sofar:
    count += 1
    min_sofar = num
print(count)

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

mn = int(1e9)
ans = 0

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

print(ans)

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

Solution (Python):
n=int(input())
p_list=list(map(int, input().split()))
num_i=0

minimum=n+1
for p in p_list:
  if p<minimum:
    num_i+=1
    minimum=p
    if p==1:
      break

print(num_i)

Solution (Python):
def solve(n, p):
    q = [n] * n
    q[0] = p[0]
    for i in range(1, n):
        q[i] = min(q[i-1], p[i])
    ans = 0
    for i in range(n):
        if p[i] <= q[i]:
            ans += 1
    return ans

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

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

ans,now=0,float('inf')
for p in P:
  if now>p:
    now=p
    ans+=1
print(ans)

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

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

Solution (Python):

N = int(input())
P = list(map(int, input().split()))
c = 10**9
count = 0
for i in P:
    
    
    if i < c:
        c=i
        count+=1
print(count)

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

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

Solution (Python):
N, *P = map(int, open(0).read().split())

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

print(ans)

Solution (Python):
def getCount(nums):
    cnt = 1
    mmin = nums[0]
    for i in range(1,len(nums)):
        if nums[i] < mmin:
            cnt+=1
        mmin = min(nums[i],mmin)
    return cnt    

n = input()
nums = list(map(int, input().split(" ")))
print(getCount(nums))

Solution (Python):
n=int(input())
p=[int(x) for x in input().split()]
min_i=float("inf")
ans=0
for i in range(n):
    if min_i>=p[i]:
        ans+=1
        min_i=p[i]
print(ans)

Solution (Python):
def resolve():
    N = int(input())
    p = input().split()
    num = 0
    mini = int(p[0])
    for i in range(N):
        if int(p[i])<=mini:
            num+=1
            mini=int(p[i])
    print(num)
 
 
if __name__ == "__main__":
    resolve()

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

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

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

Solution (Python):


import sys
sys.setrecursionlimit(300000)


def solve(N: int, P: "List[int]"):
    mn = float('inf')
    ret = 0
    for v in P:
        if v <= mn:
            ret += 1
        mn = min(mn, v)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    P = [int(next(tokens)) for _ in range(N)]  
    solve(N, P)

if __name__ == '__main__':
    main()

Solution (Python):
n,*a=map(int,open(0).read().split());m=[a[0]]*n;
for i in range(1,n):m[i]=min(m[i-1],a[i])
print(sum(int(a[i]==m[i]) for i in range(n)))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    p = LI_()
    r = 0
    m = inf
    for c in p:
        if m >= c:
            m = c
            r += 1

    return r


print(main())

Solution (Python):
N = int(input())
M = 0
for P in map(int, input().split()):
    if P <= N:
        N = P
        M += 1
print(M)

Solution (Python):
"""
& C:/Users/Takuki/Anaconda3/python.exe c:/Users/Takuki/Documents/competitive/main2.py
"""
n = int(input())
p = list(map(int, input().split()))
ans = 0
mn = n + 1
for i in range(n):
    if p[i] < mn:
        ans += 1
        mn = p[i]
print(ans)

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

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

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

cnt = 0
for n in p:
  if n == p[0]:
    cnt += 1
    min = n
  elif min >= n:
    cnt += 1
    min = n
print(cnt)

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

def chmin(a,b):
	if a<b:
		return a
	else:
		return b

N = int(input())
lst_P = list(map(int, input().split()))
mem = [float("Inf")]*N 

ans = 1
for i in range(1,N):
	mem[i] = chmin(mem[i-1],lst_P[i-1])
	if mem[i] >= lst_P[i]:
		ans += 1

print(ans)

Solution (Python):


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

Solution (Python):
n=int(input())
li = list(map(int,input().split()))
count=1
m=n
for i in range(1,n):
    m=min(m,li[i-1])
    if(m==1):
        break
    if(m>=li[i]):
        count+=1
print(count)

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

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

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

Solution (Python):
n=int(input())
P=list(map(int,input().split()))
ans=0
bef=float("inf")
for i in P:
    if i<=bef:
        ans+=1
        bef=i
print(ans)

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

    cnt = 0
    tmp_min = ps[0]
    for p in ps:
        if p <= tmp_min:
            cnt += 1
            tmp_min = p

    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):
def get():
    N = int(input())
    permutation = [int(x) for x in input().split(" ")]
    _min = []
    for item in permutation:
        if (len(_min) == 0):
            _min.append(item)
        else:
            _min.append(min(_min[len(_min)-1], item))
    count = 0
    for i in range(len(_min)):
        if (permutation[i] == _min[i]):
            count += 1
    print(count)

get()

Solution (Python):
import sys
input = sys.stdin.readline
 
n = int(input())
arr = list(map(int,input().split()))
count = 0
minimum = arr[0]
for num in arr:
  if num <= minimum:
    minimum = num
    count += 1
print(count)

Solution (Python):
n = int(input())
arr = input().split(' ')
arr = [int(i) for i in arr]
count = 0
minimum = arr[0]
for num in arr:
  if num <= minimum:
    minimum = num
    count += 1
print(count)

Solution (Python):
n = int(input())
arr = input().split(' ')
arr = [int(i) for i in arr]
count = 0
minimum = arr[0]
for idx in range(n):
  num = arr[idx]
  if num <= minimum:
    minimum = num
    count += 1
print(count)