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

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

count = 1
m = P[0]
for i in range(1, len(P)):
    m = min(m, P[i - 1])
    if m >= P[i]:
        count += 1

print(count)

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

List=[]
x=P[0]
for i in range(N):
    if x >= P[i]:
        x=P[i]
        List.append(P[i])
    else:
        List.append(x)

ans=1       
for i in range(N-1):
    if List[i] != List[i+1]:
        ans = ans+1

print(ans)

Solution (Python):
n = int(raw_input())
arr = [int(x) for x in raw_input().split()] 

count = 0
min_subarr = 2 * 10**5 + 1
for i in range(0, len(arr)):
	if arr[i] < min_subarr:
		min_subarr = arr[i]
		count += 1
print count

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
    else:
        pass
print(cnt)

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):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()

ans = 0
ma = 0













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

print(ans)

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

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

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

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

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

print(count)

Solution (Python):


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

minimum = 9999999999
ans = 0

for num in nums:
    if minimum >= num:
        ans += 1
        minimum = num

print(ans)

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

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

print(ans)

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

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

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


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

print(result)

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

MIN = 10e5
c = 0
for i in range(n):
  if p[i] <= MIN:
    MIN = p[i]
    c += 1
print(c)

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

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

print(count)

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

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

M = 0
m = n
count = 0

for i in range(n):
    if p[i] > M:
        M = p[i]
    else:
        pass
    if p[i] < m:
        m = p[i]
    else:
        pass
    
    if p[i] <= m:
        count += 1
    else:
        pass

print(count)

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

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

min_n = n+1
ans = 0

for aa in a:
    if min_n > aa:
        ans += 1
        min_n = aa

print(ans)

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

min = 2 * (10**5) + 1
ans = 0
for j in range(N):
    if P[j] <= min:
        ans += 1
        min = P[j]
print(ans)

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

min_num = 10**9
min_l = []
cnt = 0
for i in range(N):
  if P[i] < min_num:
    min_l.append(P[i])
    min_num = P[i]
    cnt += 1
  else:
    min_l.append(min_num)

print(cnt)

Solution (Python):
n = int(input())
P = [int(i) for i in input().split()]
r = 0
m = n+1
for i in range(n):
    if P[i] < m:
        r += 1
        m = P[i]
print(r)

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

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

bottom = 10 ** 6

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

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

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

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

c = arr[0]
ans = 1
for i in range(1, len_arr):
    c = min(c, arr[i])
    if c == arr[i]:
        ans += 1

print(ans)

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

v1 = P[0]

count = 1
for v in P[1:]:
    if v1 > v:
        count += 1
        v1 = v

print(count)

Solution (Python):
def LI():
  return [int(s) for s in input().split()]
N = int(input())
p_s = LI()

min_j = p_s[0]
count = 1

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

print(count)

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

Solution (Python):
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")


def main():
    N = int(input())
    P_1 = list(map(int, input().split()))
    logging.info("Hello!")

    min_num = 2 * 10 ** 6
    counter_i = 0
    
    for p in P_1:
        if p <= min_num:
            counter_i += 1
            min_num = p

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

Solution (Python):
import bisect
n = int(input())
seq = list(map(int,input().split()))
ans=0
s=10**6
for i in range(n):
    if seq[i]<s:
        ans+=1
        s=seq[i]
    else:
        pass
print(ans)

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

ans = 0
min_val = l[0]
for i in range(n):
    if min_val >= l[i]:
        ans += 1
        min_val = l[i]
print(ans)

Solution (Python):
n = int(input())
tmp = 2**60
ans = 0
for i in input().split(" "):
  tmp = min(tmp,int(i))
  if int(i) == tmp:
    ans += 1
print(ans)

Solution (Python):
import sys

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

count = 0
current_min = P[0]
for i in range(N):
    Pi = P[i]
    if P[i] < current_min:
        current_min = P[i]
    if P[i] > current_min:
        count += 1

ans = N - count
print(ans)

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

def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    ls = [0 for _ in range(N)]
    ans = 0
    mins = 10**10
    for i in range(N):
        mins = min(mins,P[i])
        if mins==P[i]:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()

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

ans = 1
min = p[0]

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

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

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
s = 10**10
ans = []

for i in range(n):
    if p[i] <= s:
        ans.append(p[i])
        s = p[i]


print(len(ans))

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

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

ans = 0
min_i = 2*N
for i in range(N):
    if min_i > P[i]:
        ans = ans + 1
        min_i = P[i]
print ans

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

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

print(ans)

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

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

m = 10**10

count = 0
for p in P:
    if p <= m:
        count += 1
        m = p

print(count)

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

print(cnt)

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

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

Solution (Python):


N = int(input())
P = [int(el) for el in input().split(' ')]
min_val = N+1
ans = 0

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

print(ans)

Solution (Python):
def mainFunc():
    N = int(input())
    arr = list(map(int, input().split(" ")))
    minN = arr[0]
    ans = 0

    for i in range(N):
        if minN >= arr[i]:
            minN = arr[i]
        if minN >= arr[i]:
            ans += 1
    
    print(str(ans))

mainFunc()

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

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

ans = 0
minmemo = [10**6]*(N+1)
for i in range(1,N+1):
    minmemo[i] = min(P[i-1],minmemo[i-1])
    if minmemo[i] >= P[i-1]:
        ans += 1
        
print(ans)

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

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

count = 0
minNum = 10 ** 6
for i in range(1, n + 1):
  if minNum > numList[i-1]:
    minNum = numList[i-1]
    count += 1
print(count)

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

Solution (Python):


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

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

Solution (Python):
import heapq

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


if __name__ == "__main__":
    resolve()

Solution (Python):

n = int(input())
p = list(map(int, input().split()))
count = 0
tmp_min = n
for pi in p:
    if pi < tmp_min:
        tmp_min = pi
    if pi <= tmp_min:
        count += 1
print(count)

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

ans = 0
minNum = 99999999

for pin in P:
    if pin <= minNum:
        ans = ans + 1
        minNum = pin

print(ans)

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

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

print(count)

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

print(ans)

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

result = 0
m = None
for p in input().split():
    p = int(p)
    if m is not None:
        if m < p:
            result += 1
    if m is None or p < m:
        m = p

print(N - result)

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

res = 1
minp = P[0]
for p in P[1:]:
  if p < minp:
    minp = p
    res += 1
print(res)

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

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

print(cnt)

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

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

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

print(count)

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 permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

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

def main():
    n = INT()
    p = LIST()
    ans = 0

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


if __name__=='__main__':
    main()

Solution (Python):
n = int(input())
p = [int(x) for x in input().split()]
m = p[0]
ans = 1
for idx in range(1,len(p)):
    if m > p[idx]:
        ans += 1
        m = p[idx]
print(ans)

Solution (Python):

def solve(nums):
  curr_min = 2 * 10**5 + 1
  ans = 0
  for n in nums:
    if n <= curr_min:
      ans += 1
    curr_min = min(curr_min, n)
  print(ans)

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


N = iin()
nums = iln()
solve(nums)

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

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

print(ans)

Solution (Python):
N = int(input())
P = list(map(int, input().split()))
PP = [P[0]]
for p in P[1:]:
    PP.append(min(PP[-1], p))
ans = 0
for p, pp in zip(P, PP):
    if pp >= p:
        ans += 1
print(ans)

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

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

Solution (Python):
from sys import stdin


def main():
    N = input()
    P = [int(x) for x in stdin.readline().rstrip().split()]

    min_now = P[0]
    count = 0

    for p in P:
        if p <= min_now:
            count += 1
            min_now = p
        else:
            pass

    print(count)


if __name__ == "__main__":
    main()

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

n = int(input())
p = input().split()

min_n = 2.1 * 10**5
count = 0
for j in range(n):
    if min_n > int(p[j]):
        count += 1
        min_n = int(p[j])
print(count)

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

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

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

Solution (Python):

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

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

ans = 0
min_n = 0
for i in range(len(p)):
    if i==0:
        ans += 1
        min_n = p[i]
    else:
        if p[i] <= min_n:
            ans += 1
            min_n = p[i]
        else:
            pass

print(ans)

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

ans=0
pre=float('inf')
for i in range(n):
       if P[i]<=pre:
              ans+=1
              pre=P[i]
print(ans)

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

mn = max(A) + 7
c = 0

for i in A:
    if i < mn:
        mn = i
        c += 1
print c

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

Solution (Python):

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

        elif P[i] <= min:
            cnt += 1
            min = P[i]
    print(cnt)

ABC152C()

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

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

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

Solution (Python):

from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left

N=int(input())
Pn=list(map(int, input().split()))
p_min = [10**5 + 7 for i in range(N+1)]

cnt = 1
p_min[0] = Pn[0]
for i in range(1, N):
    p_i = Pn[i]
    p_j = min(p_i, p_min[i-1])
    p_min[i] = p_j
    if p_i <= p_j:
        cnt += 1
print(cnt)

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

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

print(ret)

Solution (Python):


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

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

print(count)

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

m = P[0]
c = 1

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

print(c)

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

tmp_min = n+1
counter = 0
for i in range(n):
    if tmp_min > p[i]:
        tmp_min = p[i]
    if tmp_min < p[i]:
        counter +=1
print(n-counter)

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

Solution (Python):
N = int(input())
P = [int(e) for e in input().split()]
i_count = 0
min_P = 200001

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

print(i_count)

Solution (Python):
def main():
    _ = input() 
    P = [int(x) for x in input().split()]
    count = 1
    min_num = P[0]
    for p in P[1:]:
        if min_num >= p:
            count += 1
        if p < min_num:
            min_num = p
        
    print(count)

if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
s=[l[0]]
for i in range(1,n):
    s.append(min(s[i-1],l[i]))

cnt=0
for i in range(n):
    if s[i]>=l[i]:
      cnt+=1
print(cnt)

Solution (Python):


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

minP = N + 1
cnt = 0

for p in P:
    if p < minP:
        cnt += 1
        minP = p

print(cnt)

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

pf = [0]*n
mn = 1e9
for i in range(0,n):
    mn = min(mn,a[i])
    pf[i] = mn
    
cn = 0
for i in range(n):
    if(a[i]<=pf[i]):
        cn += 1
        
print(cn)

Solution (Python):
N = int(input())
P = [int(p) for p in input().split()]
m = P[0]
count = 0
for p in P:
    if p <= m:
        count += 1
        m = p

print(count)

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

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

cnt = 0
min_a  = 10 ** 9
for i in range(N):
  min_a  =  min(min_a,a_list[i])
  if min_a >= a_list[i]:
    cnt += 1
    
print(cnt)

Solution (Python):
from math import factorial
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def MS(): return map(str, input().split())

YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']



show_flg = True

p = None
XY = None
N = None


def main():
    N = I()
    P = LI()
    MP = [0] * N
    ans = 0

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

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

    print(ans)
    
    



if __name__ == '__main__':
    main()

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

cnt = 0






min_value = A[0]
for i in range(N):
    if min_value >= A[i]:
        cnt += 1
        min_value = A[i]

print(cnt)

Solution (Python):

def main():
    _ = input()
    P = [int(x) for x in input().split()]
    
    ans = 0
    min_val = P[0]
    for p in P:
        if p <= min_val:
            ans += 1
            min_val = p
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = -inf ;count = 0 ;pro = 1

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

Solution (Python):
a=int(input())
b=[int(x) for x in input().split()]
tot=0
c=b[0]
for i in range(a-1):
    if b[i+1]<c:
        tot+=1
        c=b[i+1]
print(tot+1)

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

Solution (Python):


N = int(input().split()[0])
p_list = list(map(int, input().split()))

min_p = p_list[0]
c = 0
for p in p_list:
    if p <= min_p:
        c += 1
        min_p = p

ans = c

print(ans)

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

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

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

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

temp_val = 2*(100000)+1

count = 0

for p in plist:
    if p < temp_val:
        temp_val = p
        count += 1

print(count)

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

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

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

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
ans=0
m=[]
m.append(p[0])
for i in range(1,n):
    m.append(min(p[i],m[i-1]))

for i , j in zip(p,m):
    if i <= j:
        ans+=1
print(ans)

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

ans = 0


minval = max(P)

for x in P:
    
    minval = min(minval,x)

    
    if x <= minval:
        ans += 1
    
print(ans)

Solution (Python):
N = int(input())
P = [int(i) for i in input().split()]
min_N = 2*(10**5)+1
cnt = 0
for n in range(N):
    min_N = min(min_N,P[n])
    if min_N >= P[n]:
        cnt += 1
print(cnt)

Solution (Python):
N = int(input())
P = [int(s) for s in input().split()]
count = 1
minval = P[0]
for i in [idx+1 for idx in range(N-1)]:
  if minval > P[i]:
    count += 1
    minval = P[i]
print(count)

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

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

mina = 200001
count = 0
for v in a:
    if v <= mina:
        mina = v
        count += 1

print(count)

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

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

print(count)

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
P = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
minv = N + 1
for i in range(N):
    if P[i] < minv:
        minv = P[i]
        count += 1
print(count)

Solution (Python):

def main():
    n = int(input())
    lst =list(map(int,input().split()))
    mn = lst[0]
    counter = 1
    for i in range(1,len(lst)):
        if lst[i] < mn:
            mn = lst[i]
        if lst[i] <= mn:
            counter += 1

    print(counter)




if __name__ == '__main__':
    main()

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

count = 0
mini = 1e6

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

print(count)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n = ni()
a = na()

mn = 9999999999
ct = 0
for i in range(n):
    if mn > a[i]:
        ct += 1
        mn = a[i]
print(ct)

Solution (Python):

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

print(ans)

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

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

print(ans)

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

counter = 0
Min = p[0]

for i in range(n):
  if i == 0:
    counter += 1
  else:
    if p[i] <= Min:
      counter += 1
      Min = p[i]
  
print(counter)

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

Solution (Python):
def main():
    n = int(input())
    data = [int(s) for s in input().split(" ")]
    low = data[0]
    count = 0
    for i in data:
        if low >= i:
            count += 1
            low = i
    print(count)


if __name__ == '__main__':
    main()

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

print(ans)

Solution (Python):
n = int(input())
numlist = list(map(int, input().split()))
del numlist[n::]

count = 0
minnum = max(numlist)
for i in numlist:
  if minnum >= i:
    minnum = i
    count += 1
print(count)

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

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


ans = 1

l = [p[0]]

heapq.heapify(l)

for i in range(1,n):
    tmp = heapq.heappop(l)
    heapq.heappush(l,tmp)




    if p[i] < tmp:
        ans +=1

    heapq.heappush(l,p[i])

print(ans)

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

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

cnt = 0
x = N + 1
for p in P:
    if x > p:
        cnt += 1
    x = min(x, p)

print(cnt)

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

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

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

Solution (Python):
N = int(input())
P = [int(x) for x in 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):



def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    n = int(input())
    p = list(map(int, input().split()))

    cou = 0
    m = 10**9
    for i in range(n):
        if m < p[i]:
            cou += 1
        m = min(m, p[i])
    print(n-cou)


if __name__ == '__main__':
    main()

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

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

print(ans)

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

c = 1
pmin = 1000000
for i in range(1,N):
    if P[i-1]<pmin:
        pmin = P[i-1]
    if pmin >= P[i]:
        c += 1
print(c)