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

minimum=n+1
for p in p_list:
  if p<minimum:
    num_i+=1
    minimum=p
    if p==1:
      break

print(num_i)

Submission status: Accepted

Solution code:
def solve(n, p):
    q = [n] * n
    q[0] = p[0]
    for i in range(1, n):
        q[i] = min(q[i-1], p[i])
    ans = 0
    for i in range(n):
        if p[i] <= q[i]:
            ans += 1
    return ans

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

Submission status: Accepted

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

ans,now=0,float('inf')
for p in P:
  if now>p:
    now=p
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
a=[0]*(n+1)
a[0]=n
ans=0
for ind,i in enumerate(p,1):
    a[ind]=min(i,a[ind-1])
for i in p:
    if p[i-1] <= a[i]:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc152/submissions/9600286
N = int(input())
P = list(map(int, input().split()))
c = 10**9
count = 0
for i in P:
    #リストの始めから探索
    #minを保持していく
    if i < c:
        c=i
        count+=1
print(count)

Submission status: Accepted

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

minimum = float('inf')
ans = 0
for p in P:
    if p <=minimum:
        minimum = p
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N, *P = map(int, open(0).read().split())

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

print(ans)

Submission status: Accepted

Solution code:
def getCount(nums):
    cnt = 1
    mmin = nums[0]
    for i in range(1,len(nums)):
        if nums[i] < mmin:
            cnt+=1
        mmin = min(nums[i],mmin)
    return cnt    

n = input()
nums = list(map(int, input().split(" ")))
print(getCount(nums))

Submission status: Accepted

Solution code:
n=int(input())
p=[int(x) for x in input().split()]
min_i=float("inf")
ans=0
for i in range(n):
    if min_i>=p[i]:
        ans+=1
        min_i=p[i]
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    p = input().split()
    num = 0
    mini = int(p[0])
    for i in range(N):
        if int(p[i])<=mini:
            num+=1
            mini=int(p[i])
    print(num)
 
 
if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
p=input().split()
num=0
mini=int(p[0])
for i in range(n):
    if int(p[i])<=mini:
        num+=1
        mini=int(p[i])
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, P: "List[int]"):
    mn = float('inf')
    ret = 0
    for v in P:
        if v <= mn:
            ret += 1
        mn = min(mn, v)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split());m=[a[0]]*n;
for i in range(1,n):m[i]=min(m[i-1],a[i])
print(sum(int(a[i]==m[i]) for i in range(n)))

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

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()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    p = LI_()
    r = 0
    m = inf
    for c in p:
        if m >= c:
            m = c
            r += 1

    return r


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
& C:/Users/Takuki/Anaconda3/python.exe c:/Users/Takuki/Documents/competitive/main2.py
"""
n = int(input())
p = list(map(int, input().split()))
ans = 0
mn = n + 1
for i in range(n):
    if p[i] < mn:
        ans += 1
        mn = p[i]
print(ans)

Submission status: Accepted

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

ans = 1
A = [P[0]]*N
for i,p in enumerate(P[1:],1):
    A[i] = min(A[i-1],p)
    if A[i] == p: ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

def chmin(a,b):
	if a<b:
		return a
	else:
		return b

N = int(input())
lst_P = list(map(int, input().split()))
mem = [float("Inf")]*N # mem[i]: i番目までで一番大きな値

ans = 1
for i in range(1,N):
	mem[i] = chmin(mem[i-1],lst_P[i-1])
	if mem[i] >= lst_P[i]:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:
#C - Low Elements
#条件を満たすiはpiがp1,p2,..,piで最小となる
n = int(input())
p = list(map(int,input().split()))
tmp = p[0]
ans = 1
for i in range(1,n):
    tmp = min(tmp,p[i])
    if tmp == p[i]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
li = list(map(int,input().split()))
count=1
m=n
for i in range(1,n):
    m=min(m,li[i-1])
    if(m==1):
        break
    if(m>=li[i]):
        count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
cnt = 0
detector = 1000000000
for i in range(len(P)):
  if detector > P[i]:
    cnt += 1
    detector = P[i]
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
P=list(map(int,input().split()))
ans=0
bef=float("inf")
for i in P:
    if i<=bef:
        ans+=1
        bef=i
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ps = list(map(int, input().split()))

    cnt = 0
    tmp_min = ps[0]
    for p in ps:
        if p <= tmp_min:
            cnt += 1
            tmp_min = p

    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def get():
    N = int(input())
    permutation = [int(x) for x in input().split(" ")]
    _min = []
    for item in permutation:
        if (len(_min) == 0):
            _min.append(item)
        else:
            _min.append(min(_min[len(_min)-1], item))
    count = 0
    for i in range(len(_min)):
        if (permutation[i] == _min[i]):
            count += 1
    print(count)

get()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
 
n = int(input())
arr = list(map(int,input().split()))
count = 0
minimum = arr[0]
for num in arr:
  if num <= minimum:
    minimum = num
    count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
arr = input().split(' ')
arr = [int(i) for i in arr]
count = 0
minimum = arr[0]
for num in arr:
  if num <= minimum:
    minimum = num
    count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
arr = input().split(' ')
arr = [int(i) for i in arr]
count = 0
minimum = arr[0]
for idx in range(n):
  num = arr[idx]
  if num <= minimum:
    minimum = num
    count += 1
print(count)

Submission status: Accepted

Solution code:
s = [(input().split()) for i in range(2)]
N = int(s[0][0])
t = s[1]
a = 1000000
b = 1
for i in range(N - 1):
    a = min(a,int(t[i]))
    c = int(t[i + 1])
    if a >= c:
        b = b + 1
print(b)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = 0
mini = 2*(10**5)+10
for x in range(len(a)):
    if a[x] < mini :
        mini=a[x]
        b+=1
print(b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
answer = 0
minimum = P[0]

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

Submission status: Accepted

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

ans = 0
mn = 0

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    a = [int(x) for x in input().split()]

    mins = [0] * N
    mins[0] = a[0]
    for i in range(1, N):
        mins[i] = min(mins[i-1], a[i])
    # print(mins)
    ans = 0
    for i in range(N):
        ans += a[i] <= mins[i]
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

m =p[0]
ans =0

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

print(ans)

Submission status: Accepted

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

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):
  M = min(M,p[i])
  count += int(M==p[i])
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
L=input().split()

min=int(L[0])
count=0

for i in L:
    if int(i)<=min:
        min=int(i)
        count+=1
    else:
        continue

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*p=map(int,open(0).read().split())
for i in range(1,n):p[i]=min(p[~-i],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
x,y=input,int
n,p=y(x()),list(map(y,x().split()))
for i in range(1,n):p[i]=min(p[~-i],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
x=input;y=int;n,p=y(x()),list(map(y,x().split()))
for i in range(1,n):p[i]=min(p[~-i],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
x=input;y=int
n,p=y(x()),list(map(y,x().split()))
for i in range(1,n):p[i]=min(p[~-i],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
n,p=int(input()),list(map(int,input().split()))
for i in range(1,n):p[i]=min(p[~-i],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
n,p=int(input()),list(map(int,input().split()))
for i in range(1,n):p[i]=min(p[i-1],p[i])
print(len(set(p)))

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
for i in range(1,n):p[i]=min(p[i-1],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
n=int(input())
p=[int(i) for i in input().split()]
for i in range(1,n):p[i]=min(p[i-1],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
n=int(input())
p=[int(i) for i in input().split()]
for i in range(n):
    if i!=0:p[i]=min(p[i-1],p[i])
print(len(set(p)))

Submission status: Accepted

Solution code:
N = int(input())
num = list(map(int,input().split()))
count = 0
m = num[0]
for _ in range(N):
  if m >= num[_]:
    m = num[_]
    count += 1

print(count)

Submission status: Accepted

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

small = p[0]
ans = 0
for i in range(1,n):
    if small >= p[i]:
        ans += 1
        small = p[i]
    else:
        continue

print(ans + 1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

pmin = N
cnt = 0

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

print(cnt)

Submission status: Accepted

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

min = p[0]
cnt = 1

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  ps = list(map(int, input().strip().split()))
  p_min = 2 * 20**5
  count = 0
  for p in ps:
    if p < p_min:
      count += 1
      p_min = p
  print(count)

if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
p = list(map(int,input().split()))
ans = 1 # initialization of p[0]
min_i = p[0]
for i in range(1,n):
    if p[i] <= min_i:
        ans += 1
        min_i = p[i]
    else: pass
print(ans)

Submission status: Accepted

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

cnt = 0             # 出力の個数
min_var = 2 * 10**6 # 最小値(初期値2*10^5以上)

# 比較用リストに一つずつ値をセット
for i in input_v_list:
    
    # 最小値更新
    if(min_var > i):
        min_var = i

    # i <= min のとき個数をカウント
    if(i <= min_var):
        cnt += 1

# 出力
print(cnt)

Submission status: Accepted

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

min = P[0]
ans = 1

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

print(ans)

Submission status: Accepted

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

min = P[0]
cnt = 1

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

Submission status: Accepted

Solution code:
N = int(input())
P = [ int(i) for i in input().split()]
 
num = 0
min = N
for base in range(N):
    if P[base] <= min:
        min = P[base]
        num += 1
        
print(num)

Submission status: Accepted

Solution code:
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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
ans = 0
min = p[0]

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    p = list(map(int, input().split()))
    value_min = float('inf')
    ans = 0

    for pi in p:
        if value_min > pi:
            ans += 1
            value_min = pi

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0


ans=0

n=I()
a=LI()

m=inf
for i in a:
    if i<=m:
        ans+=1
    m=min(i,m)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, *P = map(int, open(0).read().split())
ans = 0
cur = int(1e9 + 7)
for p in P:
    ans += 1 if p <= cur else 0
    cur = p if p < cur else cur
print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
P = list(map(int, input().split()))
mn = 1e+7
ans = 0
for p in P:
    if (p<mn):
        mn = p
        ans += 1
    else:
        pass
print (ans)

Submission status: Accepted

Solution code:
from itertools import accumulate
N = int(input())
P = list(map(int, input().split()))

ans = 0
accmin = accumulate(P, min)
for i, j in zip(P, accmin):
    if i <= j:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
list = [int(i) for i in input().split()]

ans = 0
min = list[0]

for j in range(N):
    if (min  >= list[j]):
        ans += 1
        min = list[j]
    else:
        continue

print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8
import itertools
n = int(input())
p = list(map(int, input().split()))
ans = 0
q = itertools.accumulate(p, min)
q = list(q)

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

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int, input().split()))
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans)))

Submission status: Accepted

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

cnt = 0
min = N + 1
flag = True

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

print(cnt)

Submission status: Accepted

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

cnt = 0
min = pow(10, 6)
flag = True

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

print(cnt)

Submission status: Accepted

Solution code:
input()
cnt = 0
min_value = 200005
for x in map(int, input().split()):
  if min_value > x:
    cnt += 1
  min_value = min(x, min_value)
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
p = [int(i) for i in input().split()]
count = 0
min_value = p[0]
for i in p:
    if i <= min_value:
        count += 1
        min_value = i
print(count)

Submission status: Accepted

Solution code:
import numpy as np

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

Q = np.minimum.accumulate(P)

print(np.count_nonzero(P <= Q))

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    arr = tuple(map(int, input().split()))
    tmp = arr[0]
    counter = 0
    for i in arr:
        if i<=tmp:
            tmp=i
            counter += 1
    print(counter)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
MIN=10**6
res=0
for i in P:
    if i<=MIN:
        MIN=i
        res+=1
print(res)

Submission status: Accepted

Solution code:
n=int(input())
l=[int(i) for i in input().split()]
mn=99999999999
c=0
for i in range(n):
    if l[i] <= mn:
        mn=l[i]
        c=c+1
print(c)

Submission status: Accepted

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

minNum = 2 * 10 ** 5
count = 0

for p in pl:
    if p <= minNum:
        minNum = p
        count += 1

print(count)

Submission status: Accepted

Solution code:
N=int(input())
P=[int(_) for _ in input().split()]
M=[0]*N
M[0]=P[0]

c=1
for i in range(1,N):
  if M[i-1]>=P[i]:
    c+=1
    M[i]=P[i]
  else:
    M[i]=M[i-1]

print(c)

Submission status: Accepted

Solution code:
n = int(input())

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

d = p[0]
ans = int(0)

for x in p:
  if d >= x:
    ans += 1
    d = x

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
count = 1
min_p = p[0]

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

print(count)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    count = n

    min = num_list[0]

    for i in range(1,n):
        if num_list[i] > min:
            count -= 1
        if num_list[i] < min:
            min = num_list[i]

    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
array = [int(n) for n in input().split()]
count,m = 1,array[0]
for k in range(1,n):
  if array[k] < m:
    m = array[k]
    count = count + 1
print(count)

Submission status: Accepted

Solution code:
# C - Low Elements
from itertools import accumulate


def main():
    N, *P = map(int, open(0).read().split())
    ans = sum(i <= j for i, j in zip(P, accumulate(P, min)))
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

res = 0
mi = 10**20
for e in a:
    if mi > e:
        res += 1
        mi = e
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = [int(i) for i in input().split()]
stan = float("inf")
ans = 0
for i in range(N):
    if stan  >= P[i]:
        stan = P[i]
        ans += 1
    else:
        pass
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
def main():
    n = int(input())
    p = list(map(int, input().split()))
    c = 0
    mi = 2*10**5+1
    for i in range(n):
        if mi > p[i]:
            c += 1
            mi = p[i]
    
    print(c)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

M = L[0]
count = 0

for i in range(N):
  M = min(M, L[i])
  if M >= L[i]:
    count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
A = list(map(int, input().split()))

a_min = 200001
count = 0
for a in A:
    if a < a_min:
        count += 1
        a_min = a

print(count)

Submission status: Accepted

Solution code:
n = int(input())
m = [int(i) for i in input().split()]
mi = 2*10**5+1
h = 0

for i in range (n):
  if mi>m[i]:
    mi=m[i]
    h+=1

    
print(h)

Submission status: Accepted

Solution code:
num = int(input())
A = list(map(int, input().split()))

a_min = 200001
count = 0
for a in A:
    if a < a_min:
        count += 1
        a_min = a

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

min_val = Ps[0]
ans = 0

for P in Ps:
    if min_val >= P:
        ans += 1
        min_val = P

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
mi=10**9
cnt= 0
for i in A:
  if mi>i:
    cnt+=1
    mi=i
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
ans = 1
P0 = P[0]

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

Submission status: Accepted

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

ans = 0
l = 10 ** 10

for i in p:
    if i < l:
        ans += 1
        l = i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

min = a[0]
count = 1
for i in range(num - 1):
  if min > a[i+1]:
    min = a[i+1]
    count += 1
print(count)