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

    num = float('inf')
    r = 0
    for pe in p:
        if num >= pe:
            r += 1
            num = pe
    print(r)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
#n,m=map(int,input().split())
#t=int(input())
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

mn=pl[0]
mnl=[]
for i in range(n):
    mn=min(mn,pl[i])
    mnl.append(mn)
res=0
for i in range(n):
    if pl[i]<=mnl[i]: res+=1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
A=set()
A.add(P[0])
a=P[0]
for i in range(N):
  if P[i]<a:
    A.add(P[i])
    a=P[i]
print(len(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *P = map(int, read().split())
min = P[0] 
ans = 1
for i in range(1,N):
    if P[i] > min:
        continue
    else:
        ans += 1
        min = P[i]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lis = list(map(int, input().split()))
min_value = lis[0]
ans = 0

for i in lis:
    if min_value >= i:
       ans += 1
       min_value = i

print(ans)

Submission status: Accepted

Solution code:
import sys

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

n = I()
p = LI()
p_min = p[0]
c = 0
for pi in p:
    if pi <= p_min:
        p_min = pi
        c += 1
print(c)

Submission status: Accepted

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
Count = 1
MIN = P[0]
for T in range(1,N):
    if P[T]<MIN:
        MIN = P[T]
        Count += 1   
print(Count)

Submission status: Accepted

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

Submission status: Accepted

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

p_min=10**10
cnt=0
for p in P:
  if p_min >= p:
    cnt+=1
    p_min=p
    
print(cnt)

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:
#152
def main():
    N = int(input())
    P = list(map(int,input().split()))
    count = 0
    min = 10000000000
    for p in P:
        if(p<=min):
            count+=1
            min=p
    print(count)
main()

Submission status: Accepted

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

Q=0
min_p=1000000
for i in range(N):
    if min(p[i],min_p)>=p[i]:
        Q+=1
    min_p=min(p[i],min_p)
print(Q)

Submission status: Accepted

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

min_num = 1000000
count = 0

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

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
 
N=int(input())
P = list(map(int, input().split()))

count = 1
min = P[0]

for i in range(1,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()))

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

Submission status: Accepted

Solution code:
N = input("")
L = input("").split(" ")
suc = int(N)
min_ = 200001

for i in range(int(N)):
    if (L[i] == 1):
        min_= 1
        continue
    if (int(min_) < int(L[i])):
        suc -= 1
        continue
    if (int(min_) >= int(L[i])):
        min_ = L[i]
print(suc)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#

import sys
from copy import deepcopy
input=sys.stdin.readline

def main():
    N=int(input())
    P=list(map(int,input().split()))
    minn=max(P)
    cnt=0
    for i in range(N):
        if minn >= P[i]:
            cnt+=1
            minn=P[i]
    print(cnt)
    
if __name__=="__main__":
    main()

Submission status: Accepted

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

count =0
mi= 3*(10**5) 
for i in range(N):
    if mi >= P[i]:
        count +=1
        mi=P[i]

print(count)

Submission status: Accepted

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

#任意の整数 j(1≤j≤i)に対して、 Pi≤Pj をみたすiの個数
inf = float("inf")
minimum = inf
counter = 0
for i in range(N):
    if P[i]<minimum:
        minimum = P[i]
        counter += 1

    

print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
count=0
MIN=P[0]
for num in P:
    if num<=MIN:
        count+=1
        MIN=num
    

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[22]:


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


# In[23]:


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


# In[ ]:

Submission status: Accepted

Solution code:
#import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm


N = int(input())
#a,b= map(int,input().split())
P = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
#prod = functools.partial(functools.reduce, operator.mul)
#c=np.array(A)
#p=np.prod(A)
c=0
mi=10**8
for i in range(N):
    if P[i] < mi:
        mi = P[i]
        if P[i]==1:
            c+=1
            print(c)
            exit()

        c+=1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
mi = 10**7
b = [0]*N
for i in range(N):
    if mi > P[i]:
        b[i] += 1
        mi=P[i]
print(sum(b))

Submission status: Accepted

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

Submission status: Accepted

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

min_p = p[0]
count = 1

for i in p[1:]:
    if i < min_p:
        count += 1
        min_p = i

print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
R = 1000000
c = 0
for i in range(N):
  if min(R, P[i])==P[i]:
    c += 1
    R = P[i]
  else:
    pass
print(c)

Submission status: Accepted

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

p = [0] * n
minv = 1e9
for i in range(n):
  minv = min(minv, a[i])
  p[i] = minv

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

print(ans)

Submission status: Accepted

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

    return

resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
P=nl()

INF=10**18
min_val=INF
ans=0
for i in P:
    if(i<=min_val):
        min_val=i
        ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

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

m = max(P)
cnt = 0

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

print(cnt)

Submission status: Accepted

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

ans = 0

min_ = data[0]
for i in range(n):
    # min_ の更新ができれば ans を更新
    if min_ >= data[i]:
        min_ = data[i]
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Min=2*100000+1
ans=0

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

print(ans)

Submission status: Accepted

Solution code:
# unihernandez22
# greedy

input()
first, *p = map(int, input().split())

last = first
ans = 1
for i in p:
    if i < last:
        ans += 1
        last = i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

max0, max1, count = p[0], 0, 0
for i in p:
    max0 = min(max0, i)
    max1 = i
    if max1 == 1:
        count += 1
        break
    elif max0 >= max1:
        count += 1
print(count)

Submission status: Accepted

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

        
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

cur_min = 10**15
res = 0
for i in P:
  if i < cur_min:
    cur_min = i
    res += 1

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

n = readInt()
p = readInts()

minV = p[0]
ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
ans = 0
INF = 2 * 10 ** 5 + 1
Q = [INF] * N
Q[0] = P[0]

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

max_n = p[0]
min_n = p[0]
ans = 1

for i in range(1, N):
    # print("max", max_n, "min", min_n,"p[i]", p[i])
    if min_n >= p[i]:
        ans += 1
        min_n = p[i]
    # else:
        # max_n = p[i]

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
P=input().split()
Pn=[]
Pn.append(int(P[0]))

count=1
nowmin=Pn[0]

for i in range(1,len(P)):
    if int(P[i])<nowmin:
        count+=1
        nowmin = int(P[i])
    
print(count)

Submission status: Accepted

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

first=S[0]
count=1
nagasa=len(S)

for i in range(1,nagasa):
    if S[i]<first:
        count+=1
        first=S[i]
        
print(count)

Submission status: Accepted

Solution code:
N = int(input())
Pn = list(map(int, input().split()))
t = float("inf")
result = 0
for p in Pn:
    if t > p:
        result += 1
    t = min(t, p)
print(result)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=2*10**5
cnt=0
for i in a:
  if b>=i:
    cnt+=1
    b=i

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
min = pow(10, 6)
ans = 0

for num in p:
    if num <= min:
        ans += 1
        min = num

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

n = int(input())

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

m = p[0]

l = []

for x in p:
    m = min(m, x)
    l.append(m)

s = 0

for i in range(n):
    if p[i] == l[i]:
        s += 1

print(s)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
ans = 0;

min_val = 1e+8
for i in li:
    if i <= min_val:
        ans += 1
        min_val = i

print(ans)

Submission status: Accepted

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

# 最初はカウントされるから1
ans = 1
base = p[0]

for i in range(1, n):
    if p[i] < base:
        ans += 1
        # pi番目がbaseより小さかったら更新
        base = 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 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 = 1
min_num = P[0]
for n in P:
    if n < min_num:
        min_num = n
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

result = 0
current_min = 10**6
for i in range(N):
    current_min = min(current_min, P[i])
    if P[i] <= current_min:
        result += 1

print(result)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

num = n + 1
res = 0
for v in p:
  if num > v:
    res += 1
    num = v

print(res)

Submission status: Accepted

Solution code:
import math

N = int(input())

tmp = 10 ** 30
ans = 0
for P in list(map(int,input().split())):
    if P <= tmp:
        tmp = P
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
# input
n = int(input())
a = [int(i) for i in input().split()]
ans = 1
nowmin = a[0]

# main
if n != 1:
  for i in range(1, n):
    if a[i] < nowmin:
      ans += 1
      nowmin = a[i]
    if nowmin == 1:
      break

# output
print(ans)

Submission status: Accepted

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

ans = 1
min_p = p[0]

for i in range(1,n):
    if p[i] < min_p:
        ans += 1
        min_p = p[i]
    else:
        pass

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
cnt=0
s=float('inf')
for i in p:
  s=min(s,i)
  if s==i:
    cnt+=1
  
    
print(cnt)

Submission status: Accepted

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

answer = 0
min_num = 2 * 10 ** 5 + 1
for p in Ps:
    min_num = min(p, min_num)
    if min_num >= p:
        answer = answer + 1

print(answer)

Submission status: Accepted

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

n,  *p = map(int, read().split())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = list(map(int, input().split()))
    minp = N+1; cnt = 0
    for p in P:
        minp = min(minp, p)
        if minp < p:
            cnt += 1
    print(N-cnt)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:


def solve(N, Ps):
    ans = 0
    target = Ps[0]
    for p in Ps:
        if p <= target:
            ans += 1
            target = p
    print(ans)


if __name__ == '__main__':
    N = int(input())
    Ps = [int(i) for i in input().split()]
    solve(N, Ps)

Submission status: Accepted

Solution code:
N = int(input())

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

l= [P[0]]
n = P[0]
for i in range(1,N):
  if n >= P[i]:
    l.append(P[i])
    n = P[i]

print(len(l))

Submission status: Accepted

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

Submission status: Accepted

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

a = P[0]
ans = 0

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

Submission status: Accepted

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

min_tmp = N+1
ans = 0

for p in P:
    if min_tmp >= p:
        ans += 1
        min_tmp = p
    else:
        continue

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in p:
    if i <= min:
        min = i; ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

tmp = P[0]
ans = 0

for i in P:
    if i <= tmp:
        ans += 1
        tmp = i
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
mina=10**11
c=0
N=int(input())
L=list(map(int,input().split()))
for i in range(N):
  mina=min(mina,L[i])
  if mina==L[i]:
    c=c+1
print(c)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    P = list(map(int, input().split()))
    m = float('inf')
    cnt = 0
    for i in range(n):
        if P[i] < m:
            cnt += 1
            m = P[i]
    print(cnt)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(input().split())
P = [int(P[i]) for i in range(N)]
MIN = float('inf')
count = 0

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

print(count)

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
#n = 8
#p = [5,7,4,2,6,8,1,3]


m = [0] * n
m[0] = p[0]

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

#p , m ([5, 7, 4, 2, 6, 8, 1, 3], [5, 5, 4, 2, 2, 2, 1, 1])

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
 
tmpmin=n
ans=0
for val in a:
  if val<=tmpmin:
    ans+=1
    tmpmin=val
print(ans)

Submission status: Accepted

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

total = 0
mini = lis[0]
for i in range(n):
    mini = min(mini, lis[i])
    if mini == lis[i]:
        total += 1
    
print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

class abc_152:
    
    def __init__(self):
        pass
    def A(self):
        pass
    def B(self):
        pass
    def C(self):
        N=int(input())
        P=list(map(int,input().split()))
        ans_count=0
        min_p=P[0]
        
        for i in range(N):
            if P[i]<=min_p:
                ans_count+=1
                min_p=P[i]
            else:continue
        print(ans_count)
        
    def D(self):
        pass
    def E(self):
        pass
    def F(self):
        pass
    
if __name__=='__main__':
    obj=abc_152()
    obj.C()