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-----
5
4 2 5 1 3

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

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

c=1

q=p[0]

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

print(c)

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

ans = 0
m = p[0]

for i in p:
	if m >= i:
		ans += 1
		m = i

print(ans)

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

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

print(ans)

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    if N == 1:
        print(1)
        return

    L = LI()
    res = 1
    temp = L[0]
    for i in L[1:]:
        if temp >= i:
            res+=1
            temp = i
            
    print(res)
    
def __starting_point():
    main()
__starting_point()

N = int(input())
P = [int(i) for i in input().split()]
ans = 0
a = N
for i in range(N):
    if(P[i] <= a):
        ans += 1
        a = min(a,P[i])
        continue
    a = min(a,P[i])
print(ans)

def main():
    n = int(input())
    p = list(map(int,input().split()))
    minp = p[0]
    cnt = 0
    for i in range(n):
        if p[i]<=minp:cnt+=1
        minp = min(minp,p[i])
    print(cnt)
main()

n = int(input())
L = list(map(int,input().split()))
mini = L[0]
ans = 0

for l in L:
  if mini >= l:
    ans += 1
    mini = l
print(ans)

N = int(input())
P = list(map(int, input().split()))
c = 10 ** 20
con = 0
for i in range(N):
  if c > P[i]:
    con += 1
    c = P[i]
print(con)
    


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

cnt = 0
mina = a[0]

for i in a:
    if i <= mina:
        cnt += 1
        mina = i

print(cnt)

N = int(input())
P = list(map(int,input().split()))
Pm = P[0]
ans = 0

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

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

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

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

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

# author:  Taichicchi
# created: 10.10.2020 13:53:46

import sys

N = int(input())

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

m = 100000000000000
cnt = 0

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

print(cnt)


n = int(input())
p_l = list(map(int, input().split()))
m_p_l = []
min_p = float('inf')
for i, p in enumerate(p_l):
    min_p = min(min_p, p)
    m_p_l.append(min_p)
ans = 0
for i, p in enumerate(p_l):
    if p == m_p_l[i]:
        ans += 1
print(ans)


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

counter = 0
curmin = 1e9
for i in l:
    curmin = min(curmin, i)
    if i == curmin:
        counter += 1
print(counter)


def resolve():
    n = int(input())
    p = tuple(map(int,input().split()))
    min_p = p[0]
    cnt = 1
    for i in range(1,n):
        if min_p > p[i]:
            min_p = p[i]
            cnt += 1
    print(cnt)
resolve()

N = int(input())
P_ls = map(int, input().split(' '))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

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

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

count = 0
min_num = float('inf')
for i in P:
    if i < min_num:
        count += 1
        min_num = i

print(count)

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

min_num = 1001001001
ans = 0
for p in pl:
    if p <= min_num:
        ans += 1
        min_num = p

print(ans)

n = int(input())
pn = [int(num) for num in input().split()]
 
maxpj = n+1
answer = 0
for pi in pn:
  if pi < maxpj:
    answer += 1
    maxpj = pi

print(answer)

N=int(input())
A=list(map(int,input().split()))
core=1
b=A[0]
for i in range(1,N):
    if b>A[i]:
        core+=1
        b=A[i]
    else:
        pass
print(core)

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

import sys
import copy
import math
import itertools
import numpy as np
N = int(input())
P = [int(c) for c in input().split()]

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

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


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

m = n+1
ans = 0

for i in lst:
    if i < m:
        ans += 1
        m = i

print(ans)

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

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    if N == 1:
        print(1)
        return

    L = TI()
    res = 1
    temp = L[0]
    for i in L[1:]:
        if temp >= i:
            res+=1
            temp = i
            
    print(res)
    
def __starting_point():
    main()
__starting_point()

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

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

n = int(input())

lst = [ int(i) for i in input().split()]
mn = lst[0]
count = 0
for d in lst:
  if mn >= d:
    count += 1
    mn = d
    
print(count)

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

n=int(input())

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

tmpmin=2*(10**5)
count=0
for i in range(n):
    if tmpmin>=plist[i]:
        tmpmin=plist[i]
        count+=1
print(count)

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

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

min_num = 10**6
cnt = 0
for i in range(n):
  if p[i] < min_num:
    min_num = p[i]
    cnt += 1
print(cnt)

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

min = s[0]
ans = 0

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

print(ans)


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

n = int(input())
a = list(map(int,input().split()))
count = 0
mina = n + 1
for i in a:
    if mina >= i:
        count += 1
        mina = i

print(count)

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

cnt = 1
min_n = S[0]
for n in S[1:]:
  #print(min_n,n)
  if n <= min_n:
    min_n = n
    cnt += 1
    
print(cnt)


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

mini = float("inf")
cnt = 0
for i in range(n):
    if p[i] <= mini:
        cnt += 1
        mini = p[i]
print(cnt)

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

ans = 0
check = 10**9 + 7

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

print(ans)

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

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

def main():
	n = int(input())
	p = [int(v) for v in input().split()]
	ans = 1
	sofar = p[0]
	for i in range(1, len(p)):
		sofar = min(p[i-1],sofar)
		if p[i] < sofar:
			ans +=1
	return ans

def __starting_point():
    print((main()))

__starting_point()

N = int(input())
P = list(map(int, input().split()))
ans = 0
num = P[0]

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

print(ans)


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

dp = [0] * N
dp[0] = P[0]
ans = 1
for i in range(1, N):
    if P[i] <= dp[i - 1]:
        dp[i] = P[i]
        ans += 1
    else:
        dp[i] = dp[i - 1]

print(ans)
return

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)

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

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

cnt = 0

for p in P:
    cnt += p <= N
    N = min(N, p)

print(cnt)

#!/usr/bin/env python3
def main():
    _ = int(input())
    P = [int(x) for x in input().split()]

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


def __starting_point():
    main()

__starting_point()

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


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

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

print(count)

import sys

n = int(input())
p = list(map(int,input().split()))
min = sys.maxsize
cnt = 0

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

print(cnt)

N = int(input())
p = list(map(int, input().split()))
 
# 条件はN=O(10^5)よりO(N)で解く
# 二重ループをすると、O(N^2)で間に合わない
# 累積和の問題（ABC-154-Dとか）と同じ発想が使える！
 
# 具体的にO(N)で解くために、最初に各iに対して、i番目までの最小値を求めておく
m = [0]*(N)
m[0] = p[0]
for i in range(1, N):
  m[i] = min(m[i-1], p[i])

# 各iまでの最小値とi番目の値を比較し、最小値の方が大きければよい
ans = 1
for i in range(1, N):
  if m[i-1] >= p[i]: ans += 1

print(ans)

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

ans = N
min_val = N

for i in range(N):
    target = P[i]

    if target < min_val:
        min_val = target

    if min_val < target:
        ans -= 1

print(ans)


n = int(input())
p = [int(s) for s in input().split()]

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

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

print(ans)


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

ans = 1
cur_min = p[0]

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

print(ans)

n = int(input())
p = list(map(int,input().split()))
ans = 0
m = 10**18

for i in p:
    if m > i:
        m = i
        ans += 1
print(ans)

N = int(input())
P_ls = map(int, input().split(' '))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

N = int(input())
P_ls = list(map(int, input().split(' ')))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

n=int(input());a=[*map(int,input().split())];count,m=0,n+1
for i in a:
  if m>i: m=i;count+=1
print(count)

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

cnt = 0
mini = float('inf')

for i in range(0, len(P)):
    if P[i] < mini:
        cnt += 1
        mini = P[i]

print(cnt)

# C
N = int(input())
P = list(map(int,input().split()))
min_p = 10**10
ans = 0
for i in range(N):
  if min_p >= P[i]:
    ans += 1
  min_p = min(min_p,P[i])
print(ans)

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

S = sorted(P, reverse = True)
cn = 0
L = []



for i in range(N):
    if i == 0:
        cn = cn + 1
        L.append(P[i])

    else:
        if P[i] > L[0]:
            continue
                
        else:
            cn = cn + 1
            L.append(P[i])
            L.pop(0)


print(cn)

N = int(input())
P = list(map(int, input().split()))
a = 0
for p in P:
    if p <= N:
        a += 1
        N = p
print(a)

N=int(input())
lst = [int(n) for n in input().split()]
m=999999
cnt = 0
for l in range(N):
    m = min(m,lst[l])
    if m==lst[l]:
        cnt+=1
print(cnt)


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

num_min = 2 * (10 ** 5)
ans = 0

for i in P_list:
    if num_min >= i:
        num_min = i
        ans += 1
    else:
        continue

print(ans)

N = int(input())
P_ls = list(map(int, input().split(' ')))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

N = int(input()) 
s = list(map(int,input().split()))
temp=1000000
count=0
for i in range(N):
    if temp>s[i]:
        count =count+1
        temp=s[i]

print(count)


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

N = int(input())
P_ls = list(map(int, input().split(' ')))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

n=int(input())
a=list(map(int,input().split()))
c=0
j=float('inf')
for i in a:
    if i<j:
        c+=1
        j=i
print(c)

import numpy as np
N = int(input())
P = [int(i) for i in input().split()]
res = 0
for p, c_min in zip(P, np.minimum.accumulate(P)):
  if p <= c_min: res+=1
    
print(res)

n = int(input())
p = list(map(int, input().split()))
ans = 1
p_min = p[0]

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

print(ans)

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

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

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

ans=1

p=P[0]

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

print(ans)

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


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

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


N = int(input())
P = list(map(int,input().split()))
T = [P[0]]+[10**10]*(N-1)
ans = 0

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

print(ans)

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

from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

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

main()

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

ans=0
tempmin=P[0]

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

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


low = 3 * 10 ** 5
cnt = 0

for x in p:
    if x < low:
        cnt += 1
        low = x
print(cnt)

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

n = int(input())
P = list(map(int, input().split()))
ans = 0
m = 200002
for p in P:
    if p <= m:
        m = p
        ans += 1
print(ans)

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

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

print(cnt)

N = int(input())
P_ls = list(map(int, input().split(' ')))
rst, min_val = 0, 10 ** 6
for i in P_ls:
    if min_val >= i:
        rst += 1
        min_val = i
print(rst)

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

n = int(input())
x = list(map(int,input().split()))
count = 1
m = x[0]

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

# coding: utf-8

def main():
    N = int(input())
    tmp = 200001
    ans = 0
    A = list(map(int, input().split()))

    for a in A:
        if a < tmp:
            ans += 1
            tmp = a

    print(ans)

def __starting_point():
    main()

__starting_point()

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

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

N = int(input())
P_ls = map(int, input().split(' '))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

N = int(input())
P_ls = map(int, input().split(' '))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[]
    n = int(input())
    numbers=list(map(int,input().split()))
    small=0
    dp=[]

    for idx,data in enumerate(numbers):
        if idx == 0:
            small=data
            dp.append(data)
        elif data < small:
            small=data
            dp.append(data)
        else:
            continue
    print(len(dp))

def __starting_point():
    main()
__starting_point()

def N():
    return int(input())
def L():
    return list(map(int,input().split()))
def NL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7

#import numpy as np
import sys
import math
import collections

n = N()
p = L()
mi = sys.maxsize
cnt = 0
for i in p:
    if i <= mi:
        cnt += 1
        mi = i
print(cnt)

n=int(input())
a=list(map(int,input().split()))
c=0
j=float('inf')
for i in a:
    if i<j:
        c+=1
    j=min(j,i)
print(c)

def main():
	n = int(input())
	p = [int(v) for v in input().split()]
	ans = 1
	sofar = p[0]
	for i in p:
		if i < sofar:
			ans +=1
			sofar = i
	return ans

def __starting_point():
    print((main()))

__starting_point()

N = int(input())
P = list(map(int,input().split()))
T = [P[0]]+[10**10]*(N-1)
ans = 0

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

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

print(ans)

n = int(input())
num = list(map(int,input().split()))
count = 10**18
ans = 0

for i in num:
  if count > i:
    count = i
    ans += 1
  
print(ans)