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:
import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
P=list(map(int,input().split()))
t=10**6
a=0
for i in P:
    if i<t:
        a+=1
        t=i
print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(c)

Submission status: Accepted

Solution code:
#min関数は計算量食うので使わない
N=int(input())
A=list(map(int,input().split()))
a=0
m=A[0]
for i in range(N):
    if A[i]<=m:
        a+=1
        m=A[i]#今のA[i]より前に小さい値がある場合に現時点の最小値としてmに記録する
print(a)

Submission status: Accepted

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

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

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

main()

Submission status: Accepted

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

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

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

main()

Submission status: Accepted

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc152/tasks/abc152_c
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    pl = list(map(int, input().split()))
    minv = n + 1
    ans = 0
    for p in pl:
        if minv > p:
            ans += 1
            minv = p
    print(ans)
    return


if __name__ == '__main__':
    main()

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:
n = int(input())
p = list(map(int, input().split()))

count = 0
mi = p[0]

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
arr = [ int(i) for i in input().split(" ") ]

tmp = 2**30

ans = 0
for ele in arr:
  if tmp > ele:
    ans += 1
    tmp = ele

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
max=float("inf")
c=0
for i in range(len(P)):
  if max>P[i]:
    max=P[i]
    c+=1
print(int(c))

Submission status: Accepted

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

count = 1
num = p[0]
for i in range(1,len(p)):
    if p[i] <= num:
        count += 1
        num = p[i]
        
print(count)

Submission status: Accepted

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

ans = 0
now_min = p_list[0]
for i in range(n):
    if now_min > p_list[i]:
        now_min = p_list[i]
    if p_list[i] <= now_min:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
f=input
f(); l=map(int,f().split())
a,m=0,200001
for i in l:
  if i<m: m=i; a+=1
print(a)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

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

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

Submission status: Accepted

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

min = P[0]
count = 0
for i in P:
    if min >= i:
        min = i
        count += 1

print(count)

Submission status: Accepted

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

min_num = float('inf')
ans = 0

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

print(ans)

Submission status: Accepted

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

cnt = 0
m = 10**6
for i in p:
    if i < m:
        m = i
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import maxsize

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

min = maxsize
cnt = 0
for i in p:
    if i <= min:
        min = i
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
p = intl()
cnt = 0
m = p[0]
for i in range(n):
    if m > p[i]:
        m = p[i]
    if p[i] <= m:
        cnt += 1
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
mi = float("inf")
cnt = 0

for p in P:
    mi = min(mi, p)
    if p <= mi:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
P_list = list(map(int, input().split(' ')))
min_val = 20 * 10**5 + 1
count = 0
for i in range(N):
    if min_val >= P_list[i]:
        count += 1
        min_val = P_list[i]
print(count)

Submission status: Accepted

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

count = 1
for i in range(1, n):
    if P[i] < P[i - 1]:
        count += 1
    else:
        P[i] = P[i - 1]

print(count)

Submission status: Accepted

Solution code:
N = input()
P = [int(x) for x in input().split()]
mn = 2 * int(1e5) + 1
ans = 0
for pn in P:
    if pn < mn:
        ans, mn = ans + 1, pn
print(ans)

Submission status: Accepted

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

m = 2 * 10 ** 5
ans = 0
for pi in p:
    m = min(m, pi)
    if m >= pi:
        ans += 1

print(ans)

Submission status: Accepted

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

t = p[0]
ans = 0

for i in p:
  if i <= t:
    ans += 1
    t = i
print(ans)

Submission status: Accepted

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

#############
# Libraries #
#############

import math

#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

#############
# Main Code #
#############

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

min = INF
ans = 0
for i in l:
  if i < min:
    min = i
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
minv = a[0]
for i in range(1,N):
  if minv > a[i]:
    cnt +=1
    minv = a[i]
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

last = p[0]
count = 1

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

print(count)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(1000000)
input = lambda: sys.stdin.readline().rstrip()

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

ans = 0
mi = 2 ** 60

for i in P:
    if i <= mi:
        ans += 1
    mi = min(mi, i)

print(ans)

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

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

N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
# L = []
# for i in range(N):
# 	L.append([l[i],i])
ans = solve(l)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

min_a = A[0]
tot = 1
for i in range(1,N):
  if min_a >= A[i]:
    min_a = A[i]
    tot += 1
print(tot)

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(P[:i+1])
    if P[i] <= m:
        m = P[i]
        # print(i)
        ans += 1
    # m = max(P[:i+1])
    # print(m)


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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


cnt=1
M=P[0]#現在の最小値
for i in range(1,N):
    if(M > P[i]):#Pの値が現在の最小値より小さかったら最小値を更新しcnt++する
        M=P[i]
        cnt+=1



print(cnt)

Submission status: Accepted

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

mi=p[0]
b=[0]*n
for i in range(n):
    if mi>p[i]:
        mi=p[i]
    b[i]=mi
print(sum(p[i]==b[i] for i in range(n)))

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい


N,*L = map(int,read().split())
ans = 0
Pj = L[0]
for i in L:
    Pj = min(Pj,i)    
    if Pj >= i:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = np.array(list(map(int, num[1].split())))

num_min = num_1[0]
count = 1

for i in range(1,num_0):
  if num_1[i] <= num_min:
    count = count + 1
    num_min = num_1[i]
    
print(count)

Submission status: Accepted

Solution code:
# from itertools import accumulate
import numpy as np

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

ans = 0

"""
for i, p in enumerate(P):
    # if np.any(P[0:i] < p): あまり以下と変わらなかった
    # if any([True for p2 in P[0:i] if p2 < p]): # 2回のループが☓ O(n^2)なので
        pass
    else:
        ans += 1
"""

"""
自分のラスト回答
P_min = list(accumulate(P, min))

for p, p_min in zip(P, P_min):
    if p == p_min:
        ans += 1
"""

P_min = np.minimum.accumulate(P)

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

Submission status: Accepted

Solution code:
from itertools import accumulate

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

ans = 0

"""
for i, p in enumerate(P):
    # if np.any(P[0:i] < p): あまり以下と変わらなかった
    # if any([True for p2 in P[0:i] if p2 < p]): # 2回のループが☓ O(n^2)なので
        pass
    else:
        ans += 1
"""

P_min = list(accumulate(P, min))

for p, p_min in zip(P, P_min):
    if p == p_min:
        ans += 1

print(ans)

Submission status: Accepted

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

min = n + 1
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
min1= 10**6
count = 0
for i in range(1,n):
	if min1 > p[i-1]:
		min1 = p[i-1]
	if min1 >= p[i]:
		#print("max=",min1,"p[i]=",p[i])
		count+=1

print(count+1)

Submission status: Accepted

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

min_a = AS[0]
count = 1
for a in AS[1:]:
  if a < min_a:
    min_a = a
    count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 1 # P[0] is counted forcely
min = P[0]
for p in P:
  # (1≤j≤i),Pj=>Pi
  if min > p:
    min = p
    cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans =1
num = P[0]

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())
P = list(map(int, input().split()))
m = P[0]
a = 0
for i in range(0, n):
    if m >= P[i]: 
        a += 1
        m = P[i]
print(a)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

MOD = 10 ** 9 +7

n = int(readline())
a = np.array(read().split(),np.int32)

q=np.minimum.accumulate(a)

answer = np.count_nonzero(a<=q)

print(answer)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

Nmax = N
Nmin = P[0]

for i in range(N):
    if P[i] <= Nmin:
        Nmin = P[i]
    else:
        Nmax += -1


print(Nmax)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

count = 0
min = p[0]

for i in range(N):
    if(min > p[i]):
        min = p[i] 

    if(p[i] <= min):
        count += 1    

print(count)

Submission status: Accepted

Solution code:
n = input()
plist = map(int, raw_input().split())

ans = 0
vmin = n
for p in plist:
    if vmin >= p:
        vmin = p
        ans += 1

print ans

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0
min = n + 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
L = [int(s) for s in input().rstrip().split(' ')]
m = 0 #min
k = 0
for i in range(len(L)):
  if i == 0:
    m = L[0]
    k += 1
  else:
    if L[i] <= m:
      m = L[i]
      k += 1
print(k)

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 >= int(P[i]):
        cnt+=1
        min = int(P[i])
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
min_p = float('inf')
ans = 0
for p in [int(x) for x in input().split()]:
  if p <= min_p:
    min_p = p
    ans += 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

p_min = [p[0],] * n

for i in range(1,n):
    if p_min[i-1] > p[i]:
        p_min[i] = p[i]
    else:
        p_min[i] = p_min[i-1]

print(sum([1 for i in range(n) if p_min[i] >= p[i]]))

Submission status: Accepted

Solution code:
N=input()
arr=input().split()

min=int(arr[0])
cnt=0
for i in range(len(arr)):
    if min >= int(arr[i]):
        cnt+=1
        min = int(arr[i])
print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#b, c = map(int, input().split())
# 文字列の入力
#s = input()
# 出力
#print("{} {}".format(a+b+c, s))

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

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

print(ans)

Submission status: Accepted

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

cout = 1
saisyou = p[0]

for i in range(n-1):
    if p[i+1] <= saisyou:
        cout = cout + 1
        saisyou = p[i+1]

print(cout)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(lambda x: int(x), input().split()))
pmin = 1e9
cnt = 0
for i in a:
	if i <= pmin:
		cnt += 1
	pmin=min(pmin, i)
print(cnt)

Submission status: Accepted

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

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 P[i]<=min:
        ans += 1
        min = P[i]
    else:
        continue

print(ans)

Submission status: Accepted

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

count = 0
minnum = 2*10**5

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
v = list(map(int, input().split(' ')))

ans = 0
mini = v[0]
for i in range(len(v)):
    mini = min(mini, v[i])
    if (mini == v[i]):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
def get(text,n):
    ans = [""]*n
    i = 0
    for x in text:
        if x==" ":
            i = i + 1
        else:
            ans[i] = ans[i]+x
    return ans

N = int(input())
text = input()
P = get(text,N)
for i in range(N):
    P[i]= int(P[i])

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

print(solve(P,N))

Submission status: Accepted

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

Submission status: Accepted

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

a = 1
mm = P[0]

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

Submission status: Accepted

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

count = 1
a = P[0]

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
ans = 0
m = float('inf')

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

Submission status: Accepted

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

Submission status: Accepted

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

min = N + 1
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()))

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 = list(map(int,input().split()))
cnt = 0
m = p[0]
for i in range(n):
  if m >= p[i]:
    cnt += 1
    m = p[i]
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_ = int(input())
numbers = list(map(int, input().split()))

curr_min = numbers[0]
count = 0
for num in numbers:
    if num <= curr_min:
        count += 1
        curr_min = num

print(count)

Submission status: Accepted

Solution code:
def count(P, N):
  cnt = 0
  min = P[0]
  M = [0] * N
  for i in range(N):
    if P[i] <= min:
      M[i] = P[i]
      min = P[i]
      cnt += 1
    else:
      M[i] = min
        
  return cnt

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
List=list(map(int,input().split()))
newList =[0] * n
count = 0
min = List[0]
# print(List)
for i in List:
    # 最小値更新
    if i < min:
        min = i
    # カウントする
    if min >= i:
        count = count + 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import numpy as np
N = int(input())
P = np.array(list(map(int, input().split())))

MIN = P[0]
count = 1
for p in P[1:]:
    if p < MIN:
        count += 1
        MIN = p

print(count)

Submission status: Accepted

Solution code:
size = int(input())
nums = list(map(int,input().split()))

min_num = nums[0]
count = 0

for num in nums:
    if num <= min_num:
        count += 1
        min_num = num

print(count)

Submission status: Accepted

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

print("%d"%(count))

Submission status: Accepted

Solution code:
import sys

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

answer = 0
prevMin = 2 ** 32
for i in range(N):
    if P[i] <= prevMin:
        answer += 1
        prevMin = P[i]

print (answer)

Submission status: Accepted

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

MIN = P[0]
count = 0

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

Submission status: Accepted

Solution code:
n = int(input())

A = list(map(int, input().split()))
small = A[0]
c = 0
for i in A:
    if small >= i:
        c += 1
        small = i
        
print(c)

Submission status: Accepted

Solution code:
def main():
    N=int(input())
    P=list(map(int,input().split()))
    L=[0 for i in range(0,N)]
    L[0]=P[0]
    for i in range(0,N-1):
        L[i+1]=min(L[i],P[i+1])
    count=0
    for i in range(0,N):
        if L[i]==P[i]:
            count+=1
    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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