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

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def main():
    
    N = Scanner.int()
    P = Scanner.map_int()
    ans = 0
    m = INF
    for i in range(N):
        if m > P[i]:
            ans += 1
        m = min(m, P[i])
    print(ans)
    return


if __name__ == "__main__":
    main()

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

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

print(ans)

Solution (Python):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    m = 10**6
    ans = 0
    for a in A:
        if a <= m:
            m = a
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
import itertools
n = int(input())
p = [int(_) for _ in input().split()]
c = list(itertools.accumulate(p, func=min))
print(sum(x == y for x, y in zip(p, c)))

Solution (Python):

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

_min = 2*(10**5)+1
ans = 0

for n in range(N):
  _ = P[n]
  if _ <= _min:
    ans += 1
    _min = _

print(ans)

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


temp=0
answer=0

for i in range(N):
    if i==0:
        answer+=1
        temp=lt[i]
    elif temp>=lt[i]:
        answer+=1
        temp=lt[i]
        
print(answer)

Solution (Python):
def low_elements(seq):
    count = 1
    m = seq[0]
    for l in range(1, len(seq)):
        if seq[l] <= m:
            count += 1
            m = seq[l]
    return count


n = int(input())
seq1 = list(map(int, input().split()))
print(low_elements((seq1)))

Solution (Python):
n = int(input())
ps  = [int(elem) for elem in input().split()]

cnt = 0
for i, p in enumerate(ps):
  if i == 0:
    last = p
    cnt += 1
  else:
    if last > p:
      last = p
      cnt += 1
print(cnt)

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

Solution (Python):
num=int(input())
line=input()
line=line.split()

count1=0
num1=200000
for i in range(num):
    if num1>=int(line[i]):
        num1=int(line[i])
        count1+=1
print(count1)

Solution (Python):
a=int(input())
b=list(map(int,input().split()))
min=0
count=0
for i in range(a):
    if min==0 or min>=b[i]:
        min=b[i]
        count+=1
print(count)

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

count = 0
min_num = 10**18
for p_i in P:
    min_num = min(min_num, p_i)
    if p_i <= min_num:
        count += 1

print(count)

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

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

Solution (Python):
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    min_a = 10**6
    ret = 0
    for i in range(N):
        if A[i] < min_a:
            ret += 1
            min_a = A[i]
            
    print(ret)
    
solve()

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

p_min = [0]*N

p_min[0] = N+1
for i in range(1,N):
	p_min[i] = min(p[i-1],p_min[i-1])

ans = 0

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

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

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

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
count = 1
minv = P[0]

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

print(count)

Solution (Python):


n = int(input())
p = list(map(int, input().split()))
tmpmin = 200001
ans = 0 

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

print(ans)

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

for i in range(n):
  cmin=min(cmin,p[i])
  if cmin==p[i]:
    ans+=1
    
print(ans)

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

print(count)

Solution (Python):
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0
minv = 0

for i in range(len(num)):
    if i ==0:
        count1 +=1
        minv = num[i]
        
    elif minv >= num[i]:
        minv = num[i]
        count1 +=1
print(count1)

Solution (Python):
a = int(input())
num = [int(x) for x in input().split()]
ans = 0
biggest = 0

for n in range(len(num)):
    if n == 0:
        ans += 1
        biggest = num[n]
    elif num[n] <= biggest:
        ans += 1
        biggest = num[n]

print(ans)

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

x = 0
min_now = max(Ps)

for i in range(N):
    if min_now >= Ps[i]:
        x += 1
        min_now = Ps[i]
print(x)

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

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

Solution (Python):

import sys


def solve(N: int, P: "List[int]"):
    answer = 1
    cur_min = P[0]
    for i in range(1,N):
        if P[i] <= cur_min:
            answer += 1
        
        cur_min = min(cur_min,P[i])
    print(answer)

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

counter = 0
min_num = 1000000

for i in range(N):
    if lst_p[i] <= min_num:
        counter += 1
        min_num = lst_p[i]
    else:
        continue
print(counter)

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

Solution (Python):

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

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

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


min = 0
out = []
list = input().split(" ")
for i in list:
  if min == 0:
    min = int(i)
    out.append(i)
  else:
    if int(i) <= min:
     
      min = int(i)
      out.append(i)
print(len(out))

Solution (Python):
n = int(input())
a = input()
l = a.split()
for i in range(0,n):
    l[i] = int(l[i])
dp = []
dp = [1]
for i in range(0,n+1):
    dp.append(0)
m = l[0]
for i in range(1,n):
    if l[i] < m:
        m = l[i]

    if m+1 >l[i]:
        dp[i] = dp[i-1]+1
    else:
        dp[i]=dp[i-1]
print(dp[n-1])

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

min = N
score = 0
for i in p:
    if i <= min:
        score += 1
        min = i
    else:
        continue

print(score)

Solution (Python):




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

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


if __name__ == "__main__":
    main()

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

res=0
minim=PN[0]
for i in PN:
  minim=min(minim,i)
  if minim>=i:
    res+=1
print(res)

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

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

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

print(ret)

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

ans = 0
X = N + 1
for p in P:
    if X > p:
        ans += 1
        X = p
print(ans)

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

mi = 10000000
count = 0
for i in range(N):
  if a[i] <= mi:
    mi = a[i]
  if a[i] == mi:
    count += 1

print(count)

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


min = P[0]
count = 1
for x in P[1:]:
  if x <= min:
    min = x
    count += 1
    
print(count)

Solution (Python):
import numpy as np
n = int(input())
p_list = np.array(list(map(int, input().split())))
cnt = 0
minimum = np.inf
for i in range(n):
  pi = p_list[i]
  if minimum > pi:
    cnt += 1
    minimum = pi
print(cnt)

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

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

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

i_min = ary[0]
i_max = ary[0]
count = 1
for i in range(1, len(ary)):
    p_i = ary[i]
    if p_i <= i_min:
        i_min = p_i
    if p_i > i_max:
        i_max = p_i
    if p_i <= i_min and p_i <= i_max:
        count += 1
print(count)

Solution (Python):
import numpy as np

N = int(input())
n = [int(x) for x in input().split()]
n=np.array(n)

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

Solution (Python):
import numpy as np

n = int(input())
p = np.array(input().split(), dtype = int)

num = 0
las = 0

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

print(num)

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

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

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

print(ret)

Solution (Python):
import numpy as np

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

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

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
P = LIST()

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

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

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

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

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

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

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

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

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

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

print(cnt)

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

count = 0 
p_length = len(p_list)
p_min = p_list[0] 

for i in range(p_length):
    if p_list[i]<=p_min:
        p_min = p_list[i]
        count = count + 1 
    else:
        continue

print(count)

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

Solution (Python):
N = int(input())
line = list(map(int,input().split()))
a = 1
m = line[0]
for i in range(N-1):
    if m >= line[i]:
        m = line[i]

    if m >= line[i+1]:
       a += 1

print(a)

Solution (Python):
import numpy as np

N = int(input())

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

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

print(count)

Solution (Python):

import sys


def solve(N: int, P: "List[int]"):
    cnt = 1
    min = P[0]
    for i in range(1, N):
        if P[i] <= min:
            cnt+=1
            min = P[i]
    return cnt



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)]  
    print(solve(N, P))

if __name__ == '__main__':
    main()

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

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

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

print(ans)

Solution (Python):
_ =input()
a = list(map(int,input().split()))
d = 100000000
ret = 0
for i in a:
  if i < d:
    ret += 1
    d = i
print(ret)

Solution (Python):
import math

def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    print(mama(n,p_list))

            
def mama(n,p_list):
    sum = 0
    top = 0
    for p in p_list:
        if sum <= 0:
            sum = sum + 1
            min = p
        else:
            if min >= p:
                sum = sum + 1
                min = p
            else:
                continue
    return sum


if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
N=int(input())
a = [int(x) for x in input().split()]
count=1
mini=a[0]

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

print(count)

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

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

min = n
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()))
m = float('INF')
ans = 0

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

Solution (Python):
def main():
    n=int(input())
    pp=map(int,input().split())
    l=c=0
    for p in pp:
        if not l or p<l:
            l=p
            c+=1
    print(c)

main()

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



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

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

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

Solution (Python):
import numpy as np
import math

v_min = np.inf

def solve(arr):
  global v_min
  count = 0
  for v in arr:
    if v <= v_min:
      count += 1
      v_min = v
  return count

if __name__ == "__main__":
  _n = int(input())
  arr = [int(i) for i in input().split()]
  ans = solve(arr)
  print(int(ans))

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

m = P[0]
ans = 0

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

print(ans)

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

print(cnt)

Solution (Python):
import numpy as np

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

res = 0
min_ = 2*10**5

for i in range(0, N):
    if P[i] <= min_:
        res += 1
    
        min_ = P[i]

print(res)

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

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

Solution (Python):
import sys
n,*p=map(int,sys.stdin.read().split())
c=0
minp=p[0]
for i in p:
  if i<=minp:
    c+=1
    minp=i
print(c)

Solution (Python):
num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = list(map(int, num[1].split()))

num_min = num_1[0]
count = 0

for i in range(0,num_0):
  if(num_min >= num_1[i]):
    count = count+1
    num_min = num_1[i]
    
print(count)

Solution (Python):
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    p = read_int_list()
    res = 0
    m = p[0]
    for i in range(n):
      if p[i] <= m:
        res += 1
        print(' i = ', i, file=sys.stderr)
      m = min(m, p[i])
    print(res)


main()

Solution (Python):
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    p = read_int_list()
    res = 0
    m = p[0]
    for i in range(n):
      if p[i] <= m:
        res += 1
      m = min(m, p[i])


    print(res)


main()

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

print(ans)

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

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

Solution (Python):
"""
問題自体は単純で、配列Pを先頭から見ていき、
見ている箇所より左側（インデックス番号が見ている箇所より小さいもの）が
すべて見ている値よりも大きければ答えをカントアップ。
配列全てを確認し終わった時点の答えを出力すれば良い。

ただし、Pの最大サイズが 2 × 10**5 なので、

for i in range(N):
    for j in range(i):
        if P[i] < P[j]:
            ans +=1
            
などとすると、　N ** 2 ≒ 10 ** 10 となり間に合わない。
ので、以下のソースのように、確認するインデックス（ i )より
左側の最小値を for文を使用せず保持して比較していけば、
計算量が N になるため、十分に間に合う。
"""


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

    
    
    ans = 1

    
    
    
    min_val = P[0]

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

            
            min_val = P[i]

            
            
            
            if min_val == 1:
                break

    
    print(ans)


if __name__ == "__main__":
    main()

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

ans = 0
mini = 10000000

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

print(ans)

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

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

print(ans)

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
preMin = [a[0]]
for i in range(1,n):
    preMin.append(min(preMin[-1],a[i]))
ans = 1
for i in range(1,n):
    if a[i]<preMin[i-1]:
        ans+=1
print(ans)

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

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

print(ans)

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

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

count = 0
minnum = a_l[0]
for i in range(n):
    if minnum >= a_l[i]:
        minnum = a_l[i]
        count += 1
    else:
        pass
 
print(count)

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

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

count = 1	
min = P[0]

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

print(count)

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

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

Solution (Python):
def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    count = 1
    tmp_min = p_list[0]
    for i in range(1, len(p_list)):
        tmp_min = min(tmp_min, p_list[i])
        if tmp_min == p_list[i]:
            count += 1

    print(count)

if __name__ == '__main__':
    main()

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

b = N + 1
ans = 0

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

print(ans)

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

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

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

print(cnt)

Solution (Python):

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)

def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max,mod=DIV):
    fac,finv,inv = [0]*max, [0]*max, [0]*max
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod -inv[mod%i] * (mod//i)%mod
        finv[i] = finv[i-1]*inv[i]%mod
    class CONV:
        def __init__(self):
            pass
        def ncr(self,n,k):
            if(n<k):
                return 0
            if(n<0 or k<0 ):
                return 0
            return fac[n]*(finv[k]*finv[n-k]%mod)%mod
    return CONV()



def main():
    N = iRaw()
    Ps = isRaw()
    ni =0
    curMin = N+1
    for i,p in enumerate(Ps):
        if p <= curMin:
            ni+=1
            curMin = p
    return ni


if __name__ == "__main__":
    print(main())

Solution (Python):

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


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

print(ans)

Solution (Python):

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

Solution (Python):
N = int(input())
sta = list(map(int, input().split()))
min_i = sta[0]
count_i = 0
for i in sta:
    if min_i > i:
        min_i = i
    if i <= min_i:
        count_i += 1

print(count_i)

Solution (Python):

class Solution:
    def solve(self, n, arr):
        count = 1
        minElement = arr[0]

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

        return count


sol = Solution()

n = int(input().strip())
arr = list(map(int, input().strip().split(" ")))

print(sol.solve(n, arr))

Solution (Python):


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

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

print(count)

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

print(cnt)

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

minVal = p[0]
cnt = 1

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

print(cnt)

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

counter = 0
min = N_list[0]
for i in range(N):
    if N_list[i] <= min:
        min = N_list[i]
        counter += 1
print(counter)
print()

Solution (Python):
n = int(input())
p = list(map(int, input().strip().split()))
mn = n + 1
cnt = 0
for pi in p:
    if pi < mn:
        cnt += 1
        mn = pi

print(cnt)

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

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

print(ans)

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

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

result = 0
min_p = ps[0]
for i in range(0,n):
  if ps[i] <= min_p:
    result += 1
    min_p = ps[i]
print(result)

Solution (Python):
class Solution:

    def solve(self, N, P) :
        max_p = N
        answer = 0

        for pn in P:
            if pn <= max_p:
                answer += 1
                max_p = pn

        return answer


if __name__ == '__main__':

    
    N = int(input())

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

    
    solution = Solution()
    print(solution.solve(N, P))

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