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())
ps = list(map(int, input().split()))

ans = 0

i = 0
while i < n:
  if i == 0:
    min_n = ps[0]
    ans += 1
  else:
    if min_n >= ps[i]:
      min_n = ps[i]
      ans += 1
  i += 1

print(ans)

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

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

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

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

ans = 1
low = P[0]

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

print(ans)

Solution (Python):
n = int(input())
numbers = list(map(int, input().split()))
count = 0
past = 10 ** 6
for i in numbers:
    if past > i:
        count += 1
        past = i
print(count)

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

ans = 1
mini = P[0]

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

print(ans)

Solution (Python):
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

load()

A = load_list()
mn = A[0]

cnt = 0
for i in range(len(A)):
    if A[i] <= mn:
        cnt += 1
        mn = A[i]

print(cnt)

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

print(ans)

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

counter = 1
minimum = lst[0]
for i in range(1, n):
  if minimum > lst[i]:
    minimum = lst[i]
    counter += 1
print(counter)

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

count = 0
ans = 0
for i in range(N):
    if i == 0:
        ans = lists[i]
        count += 1
    else:
        if ans >= lists[i]:
            count += 1
            ans = min(ans, lists[i])
        else:
            ans = min(ans, lists[i])


    
    
    
    
print(count)

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

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

min_temp = N
counter = 0

for i in range(P.index(1)+1):
    if P[i] <= min_temp:
        min_temp = P[i]
        counter += 1

print(counter)

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

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

a = list(map(int,input().split()))[:n]

r=1
min=a[0]

for i in range(1,n):
    if a[i] > min:continue
    else:
        r+=1
        min=a[i] 
    

print(r)

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

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

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

min_max = p[0]
count = 1

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

print(count)

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

v = (int(i) for i in input().split());

mn = n + 1;
res = 0;

for i in v:
    res += (mn >= i);
    mn = min(mn, i);

print(res);

Solution (Python):
n = int(input())
P = [int(x) for x in input().split()]
m = n + 1
res = 0
for p in P:
  if p < m:
    res += 1
  m = min(m, p)
print(res)

Solution (Python):
n = int(input())
lis = list(map(int, input().split()))
m = float('inf')
ans = 0
for i in range(n):
    m = min(m, lis[i])
    if min(m, lis[i]) == lis[i]:
        ans += 1
print(ans)

Solution (Python):
import numpy as np

N = int(input())
P = np.array(input().split(),np.int32)

Q = np.minimum.accumulate(P)
cnt = np.count_nonzero(P==Q)

print(cnt)

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

print(count)

Solution (Python):

x = int(input())
li = list(map(int, input().split()))

a = 0
Min = li[0]
for i in range(len(li)):
    if li[i] <= Min:
        Min = li[i]
        a += 1
print(a)

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())
Q = np.minimum.accumulate(P)
answer = (P == Q).sum()
print(answer)

Solution (Python):
n = int(input())
ps = list(map(int, input().split()))
mi = float('inf')
cnt = 0
for i in range(n):
    if mi >= ps[i]:
        cnt += 1
    mi = min(mi, ps[i])
print(cnt)

Solution (Python):
n,*p=map(int,open(0).read().split());c=0
for q in p:c+=q<=n;n=min(n,q)
print(c)

Solution (Python):
n = int(input())
p = [int(i) for i in input().split()]
c = 0
minp = p[0]
for pi in p:
    if pi < minp:
        minp = pi
        c += 1
print(c+1)

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

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

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

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

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

min_num = 3*(10**5)
count = 0

for i in p:
    if i <= min_num:
        count += 1
        min_num = i


print(count)

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

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

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

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

Solution (Python):

n = int(input())
p = list(map(int,input().split()))
ans = 0
currentMin = 10 ** 9
s = []

for i in range(n):
    if currentMin > min(currentMin,p[i]):
        currentMin = min(currentMin,p[i])
        s.append(currentMin)
    else:
        s.append(currentMin)

for i in range(len(p)):
    if p[i] == s[i]:
        ans += 1

print(ans)

Solution (Python):

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

Solution (Python):

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

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

min=1000000000
minnum=[]
for n in range(N):
	if P[n]<=min:
		minnum.append(1)
		min=P[n]
print(sum(minnum))

Solution (Python):
N = int(input())
P = list(map(int, 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):
def solve():
    n = int(input())
    p = tuple(map(int,input().split()))
    mn = 10**10
    ans = 0
    for i in p:
        if i<mn:
            ans+=1
            mn = i
    print(ans)
if __name__ == "__main__":
    solve()

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

min_i=[x[0]]
for i in range(1,n):
  min_i.append(min(min_i[i-1],x[i]))
  
count=0
for i in range(1,n):
  if min_i[i-1]<x[i]:
    count=count+1
    
print(n-count)

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

min_i=[x[0]]
for i in range(1,n):
  min_i.append(min(min_i[i-1],x[i]))
  
count=0
for i in range(n):
  if min_i[i]==x[i]:
    count=count+1
    
print(count)

Solution (Python):
n,*p=map(int,open(0).read().split())
m=n+1
ans=0
for x in p:
  if m>x:
    ans+=1
    m=x
print(ans)

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

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

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

mn=0
cnt=0

for i in range(n):
  if mn==0 or mn>p[i]:
    mn=p[i]
    cnt+=1

print(cnt)

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

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




min_i = [x[0]]
for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1

print(n-count)

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

min_i = [x[0]]
for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1

print(n-count)

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



min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1


    


print(n-count)

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

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

cnt = 1
tmp = P[0]
for i in range(1, N):
    if(P[i] <= tmp):
        cnt += 1
        tmp = P[i]
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=P[i]
print(ans)
'''
re=1
for i in range(1,N):
    if P[i]<=P[i-1]:
        print(P[i],P[i-1])
        re+=1
print(re)
'''

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

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
P = iil()
mP = P[0]
ans = 0
for i in range(n):
    if mP >= P[i]:
        ans += 1
    mP = min(mP,P[i])

print(ans)

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

p_min = []
x_min = float('inf')
for x in p:
    x_min = min(x, x_min)
    p_min.append(x_min)

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

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

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

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

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

print(ans)

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

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

print(ans)

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

minval = p[0]
ans = 1
for i in p:
    if i < minval:
        ans += 1
        minval = i

print(ans)

Solution (Python):
N=int(input())
p=list(map(int,input().split()))
p=p[::-1]
j=float("inf")
cnt=0
for _ in range(N):
    tmp=p.pop()
    j=min(j,tmp)
    if j==tmp:
        cnt+=1
print(cnt)

Solution (Python):

import sys


def solve(N: int, P: "List[int]"):
    sum = 0
    currentMin = P[0]
    for n in P:
        if n <= currentMin:
            sum += 1
        
            
        currentMin = min(currentMin, n)
    print(sum)
    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())
p = list(map(int,input().split()))

count = 0
p_min = p[0]

for elem in p:
    if elem <= p_min:
        count += 1
        p_min = elem

print(count)

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

resolve()

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

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

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

Solution (Python):
N=int(input())
P=[int(i) for i in input().split(" ")]
I=0
minP=P[0]
for i in range(N):
    if P[i]<=minP:
        I+=1
        minP=P[i]
print(I)

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

Solution (Python):
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    min_value = 1e10
    cnt = 0
    for a in A:
        if a <= min_value:
            min_value = a 
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

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

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

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

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

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

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

main()

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

main()

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

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
minval = 10**7
ans = 0

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

print(ans)

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

Solution (Python):
n=int(input())
p_i=[int(i) for i in input().split()]
bk=p_i[0]
cnt=0
for i in p_i:
  if i<=bk:
    bk=i
    cnt+=1
print(cnt)

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

num = l[0]
count = 1

for i in range(1,n):
    if num >= l[i]:
        count = count + 1
        num = l[i]

print(count)

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

tmp = p[0]
ans = 1

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

print(ans)

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

Solution (Python):
n=int(input())
numbers=input().rstrip().split(" ")
least=int(numbers[0])
count=0
for i in range(n):
    if int(numbers[i])<=least:
        least=int(numbers[i])
        count+=1
print(count)

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

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

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

    min_value = float('inf')

    counter = 0
    for i in p:
        min_value = min(min_value, i)
        if i == min_value:
            counter += 1
    print(counter)


if __name__ == '__main__':
    main()

Solution (Python):
if __name__ == '__main__':

	n = int(input())
	A = list(map(int,input().split()))
	cnt = 1
	minnum = A[0]

	for i in range(1,n):
		if A[i] <  minnum:
			cnt += 1
			minnum = A[i]

	print(cnt)

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

Solution (Python):
n = int(input())
m =list(map(int,input().split()))
ans = 0
currentmin = 1e9

for i in range(len(m)):
    currentmin = min(currentmin,m[i])
    
    
    if m[i] == currentmin:
        ans+=1
        
print(ans)

Solution (Python):

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


count =1 
P_min = P[0]
for i in range(1,N):
    if P[i-1] < P[i]: 
        
        continue
    elif P[i] <= P_min: 
        
        count +=1
        P_min = P[i]
print(count)

Solution (Python):
n=int(input())
min=2*(10**5)
cnt=0

for i in map(int,input().split()):
    if min>=i:
         min=i
         cnt+=1

print(cnt)

Solution (Python):
N = int(input())
Pi_lis = map(int, input().split(" "))

min_Pj = 99999999
ans = 0
for Pi in Pi_lis:
    if min_Pj >= Pi:
        ans += 1
        
    min_Pj = min(min_Pj, Pi)
    
print(ans)

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

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

a = N+1
b = 0

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

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

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

Solution (Python):
n = int(input())
p_n = list(map(int, input().split()))
ans = 1
p_i_1 = [p_n[0]]
m = p_n[0]
for i in range(1, n):
    if m > p_n[i]:
        ans += 1
    m = min(m, p_n[i])
    p_i_1.append(p_n[i])
    if m == 1:
        break
print(ans)

Solution (Python):
n = int(input())
p_n = list(map(int, input().split()))
ans = 1
p_i_1 = [p_n[0]]
m = p_n[0]
for i in range(1, n):
    if m > p_n[i]:
        ans += 1
    m = min(m, p_n[i])
    p_i_1.append(p_n[i])
    if m == 1:
        break
print(ans)

Solution (Python):
from sys import exit

N = int(input())
P = [int(i) for i in input().split()]
p_min = 10 ** 8
count = 0
for i in range(N):
  if P[i] == 1:
    print(count + 1)
    exit()
  elif p_min > P[i]:
    count += 1
    p_min = P[i]
print(count)

Solution (Python):
N,P=int(input()),list(map(int,input().split()))
for i in range(1,N):
    P[i]=min(P[~-i],P[i])
print(len(set(P)))

Solution (Python):
N=int(input())
P=list(map(int,input().split()))
mn=float("inf")
cnt=1
for i in range(N-1):
    mn=min(P[i],mn)
    if mn>P[i+1]:
        cnt+=1
print(cnt)

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

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

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

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

min_last = P[0]
cnt = 0
for i in range(N):
    min_last = min(min_last, P[i])
    if min_last == P[i]:
        cnt += 1

print(cnt)

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

Solution (Python):
N=int(input())
ls=[int(s) for s in input().split()]
ls2=[0 for s in range(N)]
ls2[0]=ls[0]
for i in range(1,N):
  ls2[i]=min([ls[i],ls2[i-1]])
count=0
for i in range(N):
  if ls[i]==ls2[i]:
    count+=1
print(count)

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

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
min = max(p)
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()))

rec = N
ans = 0

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

Solution (Python):




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

    answer_count = 0
    min_num = 999999
    for i in range(n):
        if min_num > p_list[i]:
            min_num = p_list[i]
            answer_count += 1

    print(answer_count)


if __name__ == "__main__":
    resolve()

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











    



cnt = 1 
min_map = [P_list[0]]
min_value = P_list[0]
for i in range(1,len(P_list)) :
    min_value = min(min_value,P_list[i])
    min_map.append(min_value)


for i in range(1,len(P_list)) :
    if (min_map[i] >= P_list[i]) :
        cnt += 1



print(cnt)

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

Solution (Python):
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
lis = inpl()

m = INF
ans = 0
for i in lis:
    if m > i:
        ans +=  1
    m = min(m, i)
print(ans)

Solution (Python):
n = input()
p = input().split()
cnt = 0
tmin = 9999999999999999999999999999

for i in range(len(p)):
	tmin = min(tmin,int(p[i]))
	if tmin >= int(p[i]):
		cnt += 1

print(cnt)

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

p = list(map(int,input().split()))
mi = p[0]
cnt = 0
for i in p:
  if mi >= i:
    cnt += 1
    mi = i

print(cnt)

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

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

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

tmp = p[0]
cnt = 1
for i in range(1,len(p)):
    if p[i] < tmp:
        cnt +=1
        tmp = p[i]
    
print(cnt)

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

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

print(ans)

Solution (Python):
import sys
import os

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    P = list(map(int, sys.stdin.buffer.readline().split()))

    ret = 0
    tmp = float('inf')
    for p in P:
        if tmp > p:
            ret += 1
            tmp = p

    print(ret)


if __name__ == '__main__':
    main()

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

tmp = n + 1
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()))
mi = 2*(10**5)
count = 0
for i in p:
    if i <= mi:
        mi = i
        count += 1
print(count)

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

mi = 1e9
count = 0
for k in range(n):
    if p[k] < mi:
        mi = p[k]
        count += 1

print(count)

Solution (Python):
N=int(input())
P=list(map(int, input().split()))
res=2*(10**5)+1
icnt=0
for p in range(len(P)):
    res=min(P[p],res)
    if res==P[p]:
        icnt+=1
print(icnt)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
cnt = 0
min_l = p[0]

for i in p:
    if min_l >= i:
        cnt += 1
    min_l = min(min_l, i)
print(cnt)

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

Solution (Python):
a= int(input())
b= input().split()
compare=int(b[0])
c=0

for i in range(a):
    if (compare>=int(b[i])):
        compare=int(b[i])
        c=c+1
        
print(c)

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

Solution (Python):
N= int (input ())
Per= input().split()
cnt=0
compare = int (Per[0])
for i in range (len(Per)):
    if (compare >= int (Per[i])):
        compare= int(Per[i])
        cnt+=1
    

print (cnt)

Solution (Python):
N = int(input())
l = input().split()
cnt = 0 
cmpp = N

for i in range (N) :
    l[i] = int(l[i])

for i in range (N) :
    if (cmpp >= l[i]) :
        cmpp = l[i]
        cnt += 1

print (cnt)

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

minn = 2e9
cnt = 0
for i in p :
    if (i <= minn) :
        cnt += 1
    minn = min (minn, i)

print (cnt)

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

p = list(map(int, input().split()))
cur_min, ans = p[0], 0

for element in p:
    ans += 1 if element <= cur_min else 0
    cur_min = min(cur_min, element)

print(ans)

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

Solution (Python):
n, *P = map(int, open(0).read().split())
min_, ans = n+1, 0
for i in range(n):
    if min_ > P[i]:
        min_ = P[i]
        ans += 1
print(ans)

Solution (Python):
import sys


INF = sys.maxsize

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

dp = [INF] * N

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

print(sum(dp[i] >= P[i] for i in range(N)))

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