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()))
q = [None]*n
q[0] = p[0]
count = 1

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

print(count)

Solution (Python):


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


minimum = P[0]
count = 0

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

print(count)

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

N = int(input())
A = map(int, input().strip().split())
min_num = N+1
ans = 0
for a in A:
    if a < min_num:
        ans += 1
        min_num = a
print(ans)

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

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

c = 0
m = p[0]
for i in p:
    if m >= i:
        c += 1
        m = i

print(c)

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

ans = 0
n = float("inf")
for p in P:
  if p <= n:
    ans += 1
    n = p
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]:
        ans += 1
        min = p[i]

print(ans)

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

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


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

print(ans)

Solution (Python):
def main():
    n = int(input())
    p = list(map(int, input().split()))
    ans = 0
    minint = p[0]
    maxint = p[0]
    for i in range(n):
        if p[i] > maxint:
            maxint = p[i]
        elif p[i] <= minint:
            ans += 1
            minint = p[i]
    print(ans)
if __name__ == "__main__":
    main()

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

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

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

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

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

ind = [0]*(n+1)
for i in range(n):
    ind[arr[i]] = i
temp = 100000000
ans = 0
for i in range(1,n+1):
    if ind[i]<temp:
        ans+=1
        temp = ind[i]
print(ans)

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

cnt = 0
mi = float('inf')
for i in range(n):
    if lst[i] <= mi:
        mi = lst[i]
        cnt += 1
print(cnt)

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

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

INF = 10 ** 7
minP = [INF] * (N + 1)

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

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

print(cnt)

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

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

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

minp = 10**6
count = 0

for i in P:
    if i <= minp:
        count += 1
        minp = i
        
print(count)

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

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

count = 0
min_p = float("inf")
for p in P:
    min_p = min(min_p, p)
    if p == min_p:
        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]
  else:
    pass
print(ans)

Solution (Python):
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n = ni()
p = na()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

    min = 2 * (10 ** 5) + 10
    c = 0
    for i in P:
        if i <= min:
            c += 1
            min = i
    print(c)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

now = p[0]
count = 0
for n in p:
    if n <= now:
        count += 1
        now = n

print(count)

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

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

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

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

print(ans)

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

pmin=10**9
answer=0
for p in plist:
  if p<pmin:
    answer+=1
    pmin=p

print(answer)

Solution (Python):
def main():

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

    min_v = float('inf')
    ans = 0
    for i in range(N):
        if p[i] <= min_v:
            ans += 1
        min_v  = min(min_v, p[i])
    return ans

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

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

Solution (Python):


import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    P = i2nn()
    min_i = P[0]
    cnt = 0
    for i in range(N):
        if min_i >= P[i]:
            min_i = P[i]
            cnt += 1
    print(cnt)
    return

main()

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

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

print(count)

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
p = list(map(int, input().split()))
class BIT:
  def __init__(self, n):
    self.n = n
    self.data = [0] * (n + 1)
    self.el = [0] * (n + 1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.data[i]
      i -= i & -i
    return s
  def add(self, i, x):
    self.el[i] += x
    while i <= self.n:
      self.data[i] += x
      i += i & -i
  def get(self, i, j = None):
    if j is None:
      return self.el[i]
    return self.sum(j) - self.sum(i)
fwk = BIT(N)
res = 0
for i in range(N):
  g = fwk.sum(p[i])
  if g > 0:
    res += 1
  fwk.add(p[i], 1)
print(N - res)

Solution (Python):
n = int(input())
p = list(map(int, input().split()))
purged_data = []
tmp = p[0] + 1
for i, e in enumerate(p):
    if tmp > e:
        purged_data.append(e)
        tmp = e
print(len(purged_data))

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


print(ans)

Solution (Python):
N = int(input())
table = [int(i) for i in input().split()]
ans = 0
tmp = float("inf")
for i in range(N):
    x = table[i]

    if tmp>x:
        ans+=1
    tmp = min(tmp,x)
print(ans)

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

min_P = P_list[0]
ans = 0

for i in P_list:
  
  
  if min_P >=i:
    
    ans += 1
    min_P = i
    
print(ans)

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

m = P[0]

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

print(N - count)

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

ans = 0
m = 10 ** 10
for i in range(n):
    m = min(m, p[i])
    if m < p[i]:
        continue
    else:
        ans += 1
print(ans)

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 = min(mini, p[i])

print(ans)

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

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


tmp = 0
ans = 0

for i in range(n):
    if i==0:
        tmp = lst[i]
        ans += 1
    else:
        if lst[i] <= tmp:
            ans += 1
        if lst[i] <= tmp:
            tmp = lst[i]
print(ans)

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

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

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

now_min = p[0]
ans = 0
for i in range(n):
    if now_min >= p[i]:
        ans += 1
        now_min = p[i]
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 P[i] <= min:
        ans += 1
        min = P[i]
print(ans)

Solution (Python):

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

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

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

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

print(count)

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

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

print(ans)

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

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

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

ans = 0

if N == 1:
    ans = 1
    print(ans)
    exit(0)

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

print(ans)

Solution (Python):
from sys import stdin
n = int(stdin.readline())
a = list(map(int,stdin.readline().split()))
m = a[0]
c = 0
for i in a:
	m = min(i,m)
	if i <= m:c -= -1
print(c)

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

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

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

now = 0
ans = 1
for i in range(1,n):
    if P[now] > P[i]:
        ans += 1
        now = i
    else:
        pass

print(ans)

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

count = 0
minimun = 2 * (10**5)+1

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

print(count)

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

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

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

lst1 = list(map(int,input().split()))
ans = 0

leftmin = 10**9

for i in range(n):
    if leftmin >= lst1[i]:
        ans += 1
    leftmin = min(leftmin,lst1[i])

print(ans)

Solution (Python):
INF = 10 ** 9
N = int(input())
p = list(map(int, input().split()))
cnt = 1
minlst = [INF] * N
minlst[0] = p[0]
for i in range(1, N):
    minlst[i] = min(minlst[i - 1], p[i])

for i in range(1, N):
    if minlst[i] >= p[i]:
        cnt += 1

print(cnt)

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

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

before_min = P[0]
kosuu = 0

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

print(kosuu)

Solution (Python):
n = int(input())
p_array = map(int, input().split())
p_min = float("inf")
count = 0
for p in p_array:
    if p_min < p:
        continue
    count += 1
    p_min = p
print(count)

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

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

num = 1000000
count = 0

for i,p in enumerate(p_list):
    if p < num:
        num = p
        count += 1

print(count)

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

Solution (Python):
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict
import bisect
from fractions import Fraction

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

min_num = P[0]

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

print(ans)

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

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

print(count)

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

min = P[0]

result = 0
for pi in P:
    if pi <= min:
        result += 1
        min = pi
print(result)

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

Solution (Python):
def solve():
    N, *P = map(int, open(0).read().split())
    
    ans = 0
    tmp = 10 ** 6
    for i in range(N):
        tmp = min(tmp, P[i])
        if P[i] <= tmp:
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):

import sys


def solve(N: int, P: "List[int]"):
    ans = 1
    m = P[0]
    for Pi in P[1:]:
        if Pi <= m:
            m = Pi
            ans += 1
    print(ans)


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()))
m = [max(p) + 1]
for pi in p:
    m.append(min(m[-1], pi))
ans = 0
for i in range(n):
    if m[i] >= p[i]:
        ans += 1
print(ans)

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

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

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

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

minp = P[0]
ans = 0

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

print(ans)

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

now = N+1

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

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

min_v = float("inf")
ans = 0
for i in range(len(p)):
    if min_v >= p[i]:
        ans += 1
    min_v = min(min_v, p[i])
print(ans)

Solution (Python):
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

n = I()
p = LI()

ans = 1

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

print(ans)

Solution (Python):
a = int(input())
b = input().split()
b = [int(i) for i in b]

miner = b[0]
count = 1
for i in b[1:]:
    if i <= miner:
        miner = i
        count += 1

print(count)

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

past_min = 10 ** 15
answer = 0

for i in range(N):
  if A[i] <= past_min:
    answer += 1
    past_min = A[i]
    
print(answer)

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

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

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

m = N + 1
res = 0

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

print(res)

Solution (Python):


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

inf = 10 ** 10

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

print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from copy import deepcopy
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = float('INF')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


class BIT:
    def __init__(self, size):
        self.bit = [0] * size
        self.size = size
        self.total = 0

    def add(self, i, w):
        x = i + 1
        self.total += w
        while x <= self.size:
            self.bit[x - 1] += w
            x += x & -x
        return

    def sum(self, i):
        res = 0
        x = i + 1
        while x:
            res += self.bit[x - 1]
            x -= x & -x
        return res


n = I()
P = LI()
bit = BIT(n + 1)
cnt = 0
for i in range(n):
    if not bit.sum(P[i] - 1):
        cnt += 1
    bit.add(P[i], 1)


print(cnt)

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

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

Solution (Python):
def solve(n, p_list):
    p_list_cum_min = [0] * n
    p_list_cum_min[0] = p_list[0]
    for i in range(1, n):
        p_list_cum_min[i] = min(p_list[i], p_list_cum_min[i - 1])

    res = 0
    for i in range(n):
        if p_list[i] <= p_list_cum_min[i]:
            res += 1

    return res


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


def test():
    assert solve(5, [4, 2, 5, 1, 3]) == 3
    assert solve(4, [4, 3, 2, 1]) == 4
    assert solve(6, [1, 2, 3, 4, 5, 6]) == 1
    assert solve(8, [5, 7, 4, 2, 6, 8, 1, 3]) == 4
    assert solve(1, [1]) == 1


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

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

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

Solution (Python):
from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    max_P = P[0]
    min_P = P[0]
    ret = 0
    for i in range(N):
        if min_P >= P[i]:
            ret += 1
            min_P = P[i]
    return ret


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

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

imin = 2*(10**5) + 1
counter = 0

for i in range(len(p)):
    if imin > p[i]:
        counter += 1
        imin = p[i]

print(counter)

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

class BIT:
    """ Binary Indexed Tree """

    def __init__(self, n):
        
        nv = 1
        while nv < n:
            nv *= 2
        self.size = nv
        self.tree = [0] * nv

    def sum(self, i):
        """ [0, i]を合計する """
        s = 0
        i += 1
        while i > 0:
            s += self.tree[i-1]
            i -= i & -i
        return s

    def add(self, i, x):
        """ 値の追加：添字i, 値x """
        i += 1
        while i <= self.size:
            self.tree[i-1] += x
            i += i & -i

    def get(self, l, r=None):
        """ 区間和の取得 [l, r) """
        
        if r is None: r = l + 1
        res = 0
        if r: res += self.sum(r-1)
        if l: res -= self.sum(l-1)
        return res

N = INT()
A = LIST()

bit = BIT(N+1)
ans = 0
for i in range(N):
    
    if bit.sum(A[i]) == 0:
        ans += 1
    bit.add(A[i], 1)
print(ans)

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

Solution (Python):


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

mn=10**20

ans=0

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

print(ans)

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

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

c = 0
nowmin = 2*(10**5)+1

for i in P:
  if nowmin >= i:
    c += 1
    nowmin = i
print(c)

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

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

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

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

min_tmp = P[0]
for i in range(n):
    
    if min_tmp >= P[i]:
        counter += 1
        min_tmp = P[i]

print(counter)

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

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

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

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

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

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

Solution (Python):
n=int(input())
lst=list(map(int, input().split()))
ans=0
min=n+1

for i in lst:
    if min>i:
        min=i
        ans+=1

print(ans)

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

min = 1000000
count = 0
for i in P:
    if min >= i:
        count += 1
        min = i
    else:
        continue
print(count)

Solution (Python):
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()
INL=LI()
MM=10**15
cnt = 0
for i in range(N):
    if INL[i] <= MM: cnt += 1
    MM=min(MM,INL[i])
print(cnt)

Solution (Python):

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

min_num = N + 1
ans = 0
for i in range(N):
    if min_num >= P_list[i]:
        min_num = P_list[i]
        ans += 1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

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



if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
x = float("inf")
count = 0
for i in range(n):
    if l[i] <= x:
        x = l[i]
        count += 1
print(count)

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

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

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

min_ = N
cnt = 0
for p in P:
    if p <= min_:
        min_ = p
        cnt += 1
print(cnt)

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

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

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

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

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

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

count = 0
x = 10 ** 6
for i in range(N):
  x = min(x, P[i])
  if x == P[i]:
    count += 1
    
print(count)

Solution (Python):
from operator import itemgetter
from math import log,ceil

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
cnt = 0
min_n = 10**9
for num in A:
  if min_n > num:
    cnt += 1
  min_n =min(min_n, num)

print(cnt)

Solution (Python):

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

min_num = 10000000
ret = 0

for i in range(n):
    if p_list[i] < min_num:
        min_num = p_list[i]
        ret = ret + 1

print(ret)

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

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

N = int(input())


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


minnum = P[0]
count = 1
for i in range(1, N):
    if minnum >= P[i]:
        count+=1
        minnum = P[i]
    else:
        pass

print(count)

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    ps= LI()
    mins = []
    min_ = 10000000
    for i, v in enumerate(ps):
        if min_ > v:
            mins.append(v)
            min_ = v
        else:
            mins.append(min_)
    count = 0
    for i in range(n):
        if mins[i] >= ps[i]:
            count += 1
    print(count)


if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math
import collections


n=int(input())
tmp = input().split()
p = list(map(lambda a: int(a), tmp))


min = p[0]
ans = 0


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