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



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
Q = []
m = 10**17
for p in P:
    m = min(m, p)
    Q.append(m)
c = 0
for x, y in zip(P, Q):
    if x <= y:
        c += 1
print(c)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    m = float("inf")
    ans = 0

    for i in [int(j) for j in input().split()]:
        if i < m:
            m = i
            ans += 1
    
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

minP = N
count = 0

for pi in map(int, input().split()):
    minP = min(minP, pi)

    if pi <= minP:
        count += 1

print(count)

Submission status: Accepted

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

check=200001
cnt=0
for i in p:
	if check > i:
		check = i
		cnt+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

cnt=1

if N==1:
    print(1)
elif N==2:
    if P[1] < P[0]:
        print(2)
    else:
        print(1)
else:
    tmp = P[0]
    if P[1] <= P[0]:
        cnt +=1
    for i in range(2,N):
        tmp = min(P[i-1],tmp)
        if P[i] <= tmp:
            cnt+=1
    print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
P_min = []
a = 200000
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int,input().split()))
a = 200000
c = 0
for i in range(n):
    if li[i] <= a:
        c += 1
        a = li[i]
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

min = P[0]
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
ans=0
now_min=n+1
for x in p:
  if now_min>=x:
    ans+=1
  now_min=min(now_min,x)
print(ans)

Submission status: Accepted

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

c=1
t=P[0]
for i in range(len(P)-1):
    if t>P[i+1]:
        c+=1
        t=P[i+1]

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 10**18
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

n = N+1
cnt = 0
for i in P:
    if i <= n:
        cnt += 1
        n = i

print(cnt)

Submission status: Accepted

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
P = inintl()

min_l = []
now_min = P[0]
ans = 0

for p in P:
    if p < now_min:
        now_min = p
    min_l.append(now_min)

for i in range(n):
    if min_l[i] == P[i]:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
cnt=0
tiny=float('inf')

for i in range(n):
  if tiny>=p[i]:
    cnt+=1
    tiny=p[i]
  else:
    pass
    
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
a = 0
s = 10**6

for p in P:
  if p<s:
    a+=1
    s=p

print(a)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
a = 0
s = 10**6

for p in P:
  if p<s:
    a+=1
  s = min(s,p)

print(a)

Submission status: Accepted

Solution code:
N = int(input())
li = list(map(int, input().split()))
an = 1
mi = li[0]
for i in range(1,N):
    if mi >= li[i]:
        an += 1
        mi = li[i]
print(an)

Submission status: Accepted

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

num = p[0]
ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
List = list(map(int, input().split()))
res = 1
mini = List[0]
for i in range(1,N):
  if List[i] <= mini:
    res += 1
  mini = min(List[i],mini)
print(res)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    tmpmin = float("inf")
    ans = 0
    for p in P:
        if tmpmin > p:
            ans += 1
        tmpmin = min(tmpmin, p)
    print(ans)

if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

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


if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
N,*P = map(int, open(0).read().split())
m = P[0]
ans = 0
for x in P:
    if x <= m:
        m = x
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
#ans = 0
#for key in range(n):
#    cnt = True
#    for i in range(key+1):
#        if p[i]<p[key]:
#            cnt = False
#    if cnt:
#        ans += 1
#print(ans)

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

Submission status: Accepted

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

mins = [P[i] for i in range(N)]

for i in range(1, N):
    if mins[i] > mins[i-1]:
        mins[i] = mins[i-1]


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

print(ans)

Submission status: Accepted

Solution code:

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

ans = 0
cur = 10 ** 6
for i in range(N):
    if X[i] <= cur:
        ans += 1
    cur = min(cur, X[i])

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
count=0
mi=N+1
for a in A:
  if a < mi:
    count+=1
    mi = a
print(count)

Submission status: Accepted

Solution code:
n=int(input())
p=[int(x) for x in input().rstrip().split()]

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    P = [int(i) for i in input().split()]
    cur = N
    ans = 0
    for num in P:
        if num <= cur:
            ans += 1
            cur = num
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

dp = [0] * N

dp[0] = P[0]

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

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

print(res)

Submission status: Accepted

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

tmpmin = float('inf')
cnt = 0
for pi in p:
    if tmpmin >= pi:
        cnt += 1
        tmpmin = pi

print(cnt)

Submission status: Accepted

Solution code:
def main():

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

min_p = 2 * ( 10 ** 5 )
cnt = 0

for p_i in p:
    if min_p >= p_i:
        min_p = p_i
        cnt += 1

print( cnt )

Submission status: Accepted

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

Submission status: Accepted

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

s = a[0]
count = 1

for i in range(1,N):
  s = min(s,a[i-1])
  if s>=a[i]:
    count+=1
    
print(count)

Submission status: Accepted

Solution code:

def solve():
#    tmp_max = P[0]
    tmp_min = P[0]
    cnt = 1
    for i in range(0,N):
        if P[i] < tmp_min:
            tmp_min = P[i]
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    N = int(input())
    P = list(map(int, input().split()))
    solve()

Submission status: Accepted

Solution code:
N,*a = map(int,open(0).read().split())
max_num = a[0]
count = 0
for i in a:
  if max_num>=i:
    count+=1
  max_num = min(i,max_num)
print(count)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
m=1<<30
ans=0
for i in p:
    m = min(i,m)
    if i<=m:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
Pli = list(map(int,input().split()))

a = Pli[0]
res = 1

for i in range(1,N):
  if Pli[i] <= a:
    a = Pli[i]
    res += 1
    
print(res)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
min_n = N + 1
ans = 0
for pi in P:
    if pi <= min_n:
        ans += 1
        min_n = pi
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
f = False
count = 0
m = P[0]
for i in range(N):
    m = min(m, P[i])
    if m >= P[i]:
        count += 1


print(count)

    # print(i)
#     for j in reversed(range(0,i)):
#         # print(j)
#         if P[i] > P[j]:
#             f = True
        
#     if f == False:
#         count += 1
#     f = False
# print(count)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

n=int(input())
L=list(map(int,input().split()))
MIN = 1<<30
ans = 0
for i in L:
    MIN = min(MIN,i)
    if i<=MIN:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
# !/usr/bin/python3

"""
https://atcoder.jp/contests/abc152/tasks/abc152_c
Low Elements.
"""
def solve(a, n):
    ans = 1
    mi = a[0]

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

    return ans

if __name__ == "__main__":
    n = int(input())
    a = [(lambda x: int(x))(x) for x in input().split()]

    print(solve(a, n))

Submission status: Accepted

Solution code:
def readinput():
    n=int(input())
    p=list(map(int,input().split()))
    return n,p

def main(n,p):
    count=0
    pmin=p[0]
    for i in range(n):
        pmin=min(p[i],pmin)
        if pmin>=p[i]:
            count+=1
    return count

if __name__=='__main__':
    n,p=readinput()
    ans=main(n,p)
    print(ans)

Submission status: Accepted

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

m = 10**6
cnt = 0
for i in range(n):
    if m >= a[i]:
        cnt += 1
        m = a[i]
print(cnt)

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math
from functools import reduce
import itertools

n = int(stdin.readline().rstrip())
p = [int(x) for x in stdin.readline().rstrip().split()]

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

minp =[p[0]]

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


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int, input().split()))
cnt = 0
m = P[0]
for p in P:
    if m >= p:
        cnt += 1
        m = p
print(cnt)

Submission status: Accepted

Solution code:
import math


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


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    P = read_ints()
    min_so_far = math.inf
    count = 0
    for p in P:
        min_so_far = min(min_so_far, p)
        if min_so_far >= p:
            count += 1
    return count


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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections as cl
import sys


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


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


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


def main():
    N = II()
    p = LI()

    ans = 0
    min_now = p[0]

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

    print(ans)


main()

Submission status: Accepted

Solution code:
_ = input()
P = [int(i) for i in input().split()]

vmin = max(P)
vmax = 0

cnt = 0
for p in P:
  if p <= vmin:
    cnt += 1
  if p < vmin:
    vmin = p
  if vmax < p:
    vmax = p
    
print(cnt)

Submission status: Accepted

Solution code:
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N = int(input())
P = inpl()
mn = 1001001001
ans = 0
for i in P:
    mn = min(mn, i)
    if i == mn:
        ans += 1
print(ans)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
P = list(map(int, input().split()))
count = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ls = list(map(int,input().split()))
ii = 0
minls = N
for i in range(N):    
    if ls[i] <= minls:
        ii += 1
    minls = min(minls,ls[i])

print(ii)

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline


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

  min_ = float('inf')
  cnt = 0
  for i in range(N):
    if P[i] < min_:
      cnt += 1
      min_ = P[i]

  print(cnt)


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input());p=list(map(int,input().split()))
count=0;m=n+1
for i in p:
  if m>i: m=i;count+=1
print(count)

Submission status: Accepted

Solution code:
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
n = int(lines.pop(0))
p_list = [int(n) for n in lines[0].split(" ")]

def _iter_minimum():
    prev = sys.maxsize
    for p in p_list:
        m = min(prev, p)
        yield m
        prev = m

mininum_list = list(_iter_minimum())

count = 0
for p, m in zip(p_list, mininum_list):
    if p == m:
        count += 1

print(count)

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N =I()
_P= LI()
#AB = [LI() for _ in range(N)]
#A,B = zip(*AB)
P = np.array(_P)
#C = np.zeros(N + 1)


def main():
    # count = 1
    # # if (len(P)==1):
    # #     return count
    # min_array =[P[0]]
    # for i in range(1,N):
    #     if (P[i]<=min_array[i-1]):
    #         count += 1    
    #     if P[i-1]>P[i]:
    #         min_array.append(P[i])
    #     else:
    #         min_array.append(P[i-1])
    # return count
# print(min_array)
    Q = np.minimum.accumulate(P)
    count = np.count_nonzero(P <= Q)
    return count

print(main())
# if ans:
#     print('Yes')
# else:
#     print('No')

Submission status: Accepted

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

ans = 0
min_p = p[0]

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

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int,input().split()))
m=N+1
c=0
for i in L:
  if m>i:
    m=i
    c+=1
print(c)

Submission status: Accepted

Solution code:
N = int(input())
P_list = [int(_) for _ in input().split()]

count = 0
min_value_dic = {}
min_value_so_far =1e6
for i in range(N):
    if P_list[i] < min_value_so_far:
        min_value_dic[i] = P_list[i]
        min_value_so_far = P_list[i]
    else:
        min_value_dic[i] = min_value_so_far

# print(min_value_dic)

for i in range(N):
    if P_list[i] <= min_value_dic[i]:
        count +=1

print(count)

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    p=LIST()
    tm=10**9
    ct=0
    for i in range(n):
        if tm>=p[i]:
            ct+=1
        tm=min(tm,p[i])
    print(ct)

if __name__=='__main__':
    do()

Submission status: Accepted

Solution code:
# import itertools
# import math

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
P = list(map(int, input().split()))
# Q = list(map(int, input().split()))
# S = input()


min = 999999999
cnt = 0
for i in P:
    if min >= i:
        cnt += 1
        min = i

print(cnt)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
Min = P[0]
cnt = 0
for Pi in P:
    if Pi <= Min:
        Min = Pi
        cnt +=1
print(cnt)

Submission status: Accepted

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

ans = 1
tmp_min = p[0]

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    P = [int(x) for x in input().split()]
    minv = 2 * 10 ** 5 + 1
    cnt = 0
    for i in range(n):
        if minv > P[i]:
            minv = P[i]
            cnt += 1
    print(cnt)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
li = list(map(int, input().split()))
minL = 2 * (10**6)
count = 0
for l in li:
  if (minL >= l):
    count += 1
    minL = l
print(count)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    *P, = map(int, input().split())

    mi = N + 1
    ret = 0
    for x in P:
        if mi > x:
            mi = x
            ret += 1

    print(ret)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok

Submission status: Accepted

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

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

Submission status: Accepted

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

tmp_min = p[0]
cnt = 0

for i in range(n):
    if p[i] <= tmp_min:
        tmp_min = p[i] #i番目までの最小値を更新
        cnt += 1

print(cnt)

Submission status: Accepted

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

ans = [0]*N
min_cal = [0]*N
min_cal[0] = P[0]

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

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

print(sum(ans))

Submission status: Accepted

Solution code:
n,*p=map(int,open(0).read().split())
c=0
min_p=p[0]
for i in range(n):
    min_p=min(min_p,p[i])
    if p[i]<=min_p:
        c+=1
print(c)

Submission status: Accepted

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

if n==1:
  print(1)
  
else:
  min1=a[0]
  ans=1
  for x in range(1,n):
    if min1>=a[x]:
      ans+=1
    min1=min(min1,a[x])
    
  print(ans)

Submission status: Accepted

Solution code:
N=int(input())
L=list(map(int,input().split()))
ans=1
M=L[0]
for i in range(1,N):
  if M>=L[i]:
    M=L[i]
    ans+=1
  else:
    continue
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
p=lmp()
ans=0
m=2*n
for i in range(n):
    if p[i]<=m:
        ans+=1
        m=p[i]
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
P = sorted([(P[i],i) for i in range(N)],key=lambda x:x[0])
cnt = 1
imin = P[0][1]
for i in range(1,N):
    ind = P[i][1]
    if ind<imin:
        cnt += 1
        imin = ind
print(cnt)

Submission status: Accepted

Solution code:
def resolve():
  n = int(input())
  p = list(map(int, input().split()))
  m = 1000000000
  ans = 0
  for i in range(n):
    if p[i] <= m:
      ans += 1
    m = min(m, p[i])

  print(ans)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ps = list(mapint())

m = 10**18
ans = 0
for p in Ps:
    if p<=m:
        ans += 1
        m = p

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
mi = 10**6
ans = 0
for i in range(n):
    mi = min(mi, p[i])
    if p[i]<=mi:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

M = N+1
cnt = 0
for p in P:
    if p < M:
        cnt += 1
        M = p

print(cnt)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n = ini()
p = inl()


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


print(solve())

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
m = P[0]
S = 0
for p in P:
  if m>=p:
    S += 1
  m = min(m, p)
print(S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = input().split(' ')
P = [int(P[i]) for i in range(N)]
count = 0
PS = []
min = 2*10**5+1
for i in range(N):
  p = P[i]
  if p<=min:
    min = p
    count += 1
print(count)

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict
import sys

sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
from copy import deepcopy
import queue
from collections import deque





def main():
    num = int(input())
    data = list(map(int, input().split()))

    now_num = 10 ** 10
    ans = 0

    for i in range(num):
        if data[i] < now_num:
            now_num = data[i]
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

minimum = 2e6
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
 
mmin = P[0]
ans = 0
for i in range(N):
  if mmin < P[i]:
    continue
  else:
    mmin = P[i]
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
m = n
q = 2 * (10 ** 5)

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

print(m)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
mi = n+2
ans = 0
for i in a:
   if mi > i:
      ans+=1
      
   mi=min(i,mi)

print(ans)

Submission status: Accepted

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