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 ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
P = iil()
mP = P[0]
ans = 0
for i in range(n):
    if mP >= P[i]:
        ans += 1
    mP = min(mP,P[i])

print(ans)

Submission status: Accepted

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

p_min = []
x_min = float('inf')
for x in p:
    x_min = min(x, x_min)
    p_min.append(x_min)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

minval = p[0]
ans = 1
for i in p:
    if i < minval:
        ans += 1
        minval = i

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
p=list(map(int,input().split()))
p=p[::-1]
j=float("inf")
cnt=0
for _ in range(N):
    tmp=p.pop()
    j=min(j,tmp)
    if j==tmp:
        cnt+=1
print(cnt)

Submission status: Accepted

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


def solve(N: int, P: "List[int]"):
    sum = 0
    currentMin = P[0]
    for n in P:
        if n <= currentMin:
            sum += 1
        # else:
            # print(f"m:{n}")
        currentMin = min(currentMin, n)
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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 = int(input())
p = list(map(int,input().split()))

count = 0
p_min = p[0]

for elem in p:
    if elem <= p_min:
        count += 1
        p_min = elem

print(count)

Submission status: Accepted

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

resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    min_value = 1e10
    cnt = 0
    for a in A:
        if a <= min_value:
            min_value = a 
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
minval = 10**7
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
num=100000000
ans=0
for i in P:
  if num>i:
    ans+=1
    num=i
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
p_i=[int(i) for i in input().split()]
bk=p_i[0]
cnt=0
for i in p_i:
  if i<=bk:
    bk=i
    cnt+=1
print(cnt)

Submission status: Accepted

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

num = l[0]
count = 1

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

print(count)

Submission status: Accepted

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

tmp = p[0]
ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
numbers=input().rstrip().split(" ")
least=int(numbers[0])
count=0
for i in range(n):
    if int(numbers[i])<=least:
        least=int(numbers[i])
        count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    min_value = float('inf')

    counter = 0
    for i in p:
        min_value = min(min_value, i)
        if i == min_value:
            counter += 1
    print(counter)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	n = int(input())
	A = list(map(int,input().split()))
	cnt = 1
	minnum = A[0]

	for i in range(1,n):
		if A[i] <  minnum:
			cnt += 1
			minnum = A[i]

	print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
m =list(map(int,input().split()))
ans = 0
currentmin = 1e9

for i in range(len(m)):
    currentmin = min(currentmin,m[i])
    #print(s)
    #print(max(s))
    if m[i] == currentmin:
        ans+=1
        
print(ans)

Submission status: Accepted

Solution code:
# 初期入力
N = int(input())
P = list(map(int, input().split()))

#　右から１つ目と２つ目だけ比較し分岐
count =1 # 一つ目（添え字０）は必ずOK
P_min = P[0]
for i in range(1,N):
    if P[i-1] < P[i]: # 増えていたら×
        #print(P[i],P[:i+1])
        continue
    elif P[i] <= P_min: # 今までのPで最小値ならOK
        #print(P[i],P[:i+1])
        count +=1
        P_min = P[i]
print(count)

Submission status: Accepted

Solution code:
n=int(input())
min=2*(10**5)
cnt=0

for i in map(int,input().split()):
    if min>=i:
         min=i
         cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
Pi_lis = map(int, input().split(" "))

min_Pj = 99999999
ans = 0
for Pi in Pi_lis:
    if min_Pj >= Pi:
        ans += 1
        
    min_Pj = min(min_Pj, Pi)
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a = N+1
b = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit

N = int(input())
P = [int(i) for i in input().split()]
p_min = 10 ** 8
count = 0
for i in range(N):
  if P[i] == 1:
    print(count + 1)
    exit()
  elif p_min > P[i]:
    count += 1
    p_min = P[i]
print(count)

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=int(input())
P=list(map(int,input().split()))
mn=float("inf")
cnt=1
for i in range(N-1):
    mn=min(P[i],mn)
    if mn>P[i+1]:
        cnt+=1
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
ls=[int(s) for s in input().split()]
ls2=[0 for s in range(N)]
ls2[0]=ls[0]
for i in range(1,N):
  ls2[i]=min([ls[i],ls2[i-1]])
count=0
for i in range(N):
  if ls[i]==ls2[i]:
    count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

rec = N
ans = 0

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

Submission status: Accepted

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


def resolve():
    n = int(input())
    p_list = list(map(int, input().split()))

    answer_count = 0
    min_num = 999999
    for i in range(n):
        if min_num > p_list[i]:
            min_num = p_list[i]
            answer_count += 1

    print(answer_count)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

# cnt = 1 # 1件目は必ず合致するので

# for i in range(1,len(P_list)) :
#     pi = P_list[i]
#     is_match = True
#     for j in range(i) : # Pi==Pjは必ず正なのでジャッジ不要
#         pj = P_list[j]
#         if (pi > pj) :
#             is_match = False
#             break
    
#     if (is_match) :
#         cnt += 1

cnt = 1 # 1件目は必ず合致するので
min_map = [P_list[0]]
min_value = P_list[0]
for i in range(1,len(P_list)) :
    min_value = min(min_value,P_list[i])
    min_map.append(min_value)

# print(min_map)
for i in range(1,len(P_list)) :
    if (min_map[i] >= P_list[i]) :
        cnt += 1



print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

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

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

def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
lis = inpl()

m = INF
ans = 0
for i in lis:
    if m > i:
        ans +=  1
    m = min(m, i)
print(ans)

Submission status: Accepted

Solution code:
n = input()
p = input().split()
cnt = 0
tmin = 9999999999999999999999999999

for i in range(len(p)):
	tmin = min(tmin,int(p[i]))
	if tmin >= int(p[i]):
		cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

p = list(map(int,input().split()))
mi = p[0]
cnt = 0
for i in p:
  if mi >= i:
    cnt += 1
    mi = i

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import os

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    P = list(map(int, sys.stdin.buffer.readline().split()))

    ret = 0
    tmp = float('inf')
    for p in P:
        if tmp > p:
            ret += 1
            tmp = p

    print(ret)


if __name__ == '__main__':
    main()

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 p[i] <= min:
        count += 1
        min = p[i]

print(count)

Submission status: Accepted

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

tmp = n + 1
ans = 0
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()))
mi = 2*(10**5)
count = 0
for i in p:
    if i <= mi:
        mi = i
        count += 1
print(count)

Submission status: Accepted

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

mi = 1e9
count = 0
for k in range(n):
    if p[k] < mi:
        mi = p[k]
        count += 1

print(count)

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int, input().split()))
res=2*(10**5)+1
icnt=0
for p in range(len(P)):
    res=min(P[p],res)
    if res==P[p]:
        icnt+=1
print(icnt)

Submission status: Accepted

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

for i in p:
    if min_l >= i:
        cnt += 1
    min_l = min(min_l, i)
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a= int(input())
b= input().split()
compare=int(b[0])
c=0

for i in range(a):
    if (compare>=int(b[i])):
        compare=int(b[i])
        c=c+1
        
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N= int (input ())
Per= input().split()
cnt=0
compare = int (Per[0])
for i in range (len(Per)):
    if (compare >= int (Per[i])):
        compare= int(Per[i])
        cnt+=1
    

print (cnt)

Submission status: Accepted

Solution code:
N = int(input())
l = input().split()
cnt = 0 
cmpp = N

for i in range (N) :
    l[i] = int(l[i])

for i in range (N) :
    if (cmpp >= l[i]) :
        cmpp = l[i]
        cnt += 1

print (cnt)

Submission status: Accepted

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

minn = 2e9
cnt = 0
for i in p :
    if (i <= minn) :
        cnt += 1
    minn = min (minn, i)

print (cnt)

Submission status: Accepted

Solution code:
n = int(input())

p = list(map(int, input().split()))
cur_min, ans = p[0], 0

for element in p:
    ans += 1 if element <= cur_min else 0
    cur_min = min(cur_min, element)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, *P = map(int, open(0).read().split())
min_, ans = n+1, 0
for i in range(n):
    if min_ > P[i]:
        min_ = P[i]
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys


INF = sys.maxsize

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

dp = [INF] * N

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

print(sum(dp[i] >= P[i] for i in range(N)))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int, input().split()))
ans = 0
min = n+1

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

Submission status: Accepted

Solution code:
n = int(input())
list_p = list(map(int, input().split()))
MAX_num = 2 * pow(10,6)

min_p = MAX_num
count = 0
for num in list_p:
  if num < min_p:
    count +=1
    min_p = num

print(count)

Submission status: Accepted

Solution code:
n = int(input())
numbers = list(map(int, input().split(' ')))
counter = 0
min_value = numbers[0]
for number in numbers:
    if number <= min_value:
        counter += 1
        min_value = number

print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

N = int(input())
P = list(map(int, input().split()))
ans = 1
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())
l=list(map(int,input().split()))

m=[0]*n
a=99999999
for i in range(n):
    if l[i]<a:
        m[i]=l[i]
        a=l[i]
    else:
        m[i]=a
ans=0
for j in range(n):
    if l[j]<=m[j]:
        ans+=1

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=ans+1
        MIN=P[i]
print(ans)

Submission status: Accepted

Solution code:
s = [input() for _ in range(2)]
N = int(s[0])
P = s[1].split()
for i in range(N):
    P[i] = int(P[i])
P = [N+1] + P

count = 0
min_p = N+1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = 0
mi = float('inf')
for p in pl:
	if p<mi:
		ans += 1
	mi = min(mi, p)
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,N):
  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
mx = p[0]
for i in range(N):
    if p[i] <= mx:
        ans += 1
        mx = min(mx,p[i])
print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

a = 10**6
ans = 0
for i in range(n):
    if listn[i] <= a:
        a = listn[i]
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():

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

resolve()

Submission status: Accepted

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


for i in range(len(P)):

    if left_min >= P[i]:
        left_min = P[i]

    if P[i] <= left_min:
        count += 1
        

        
print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n = int(input().strip())
    a = list(map(int, input().strip().split()))
    cnt = 0
    temp = sys.maxsize
    for i in range(n):
        if a[i] <= temp:
            cnt += 1
            temp = a[i]
        else:
            pass
    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
def get_ints():
    return map(int, input().split())

n = int(input())
ps = get_ints()
minimum = 10000000
ans = 0
for p in ps:
    if p < minimum:
        ans += 1
        minimum = p

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def solve():
    N = int(input())
    Ps = list(map(int, input().split()))

    mn = Ps[0]
    ans = 1  # 0番目は必ず答えになるので
    for i in range(1, N):
        ans += 1 if mn >= Ps[i] else 0
        mn = min(mn, Ps[i])
    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
# coding: utf-8

# 標準入力 <int>
N = int(input())

# 標準入力 <int> list[]
P = list(map(int, input().split()))

count = 0
comp = 2 * (10**5)

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = input().split(" ")

t = 1
list = []
for i in range(N):
    list.append(int(P[i]))
    if i == 0:
        m = int(P[0])
    elif int(P[i]) < m:
        m = int(P[i])
        t = t + 1
        
print(t)

Submission status: Accepted

Solution code:
N = int(input())
P = input().split(" ")

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

print(t)

Submission status: Accepted

Solution code:

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
p = na()
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])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def solve(N: int, P: "List[int]"):
    M = [float('inf')]
    for p in P:
        if p < M[-1]:
            M.append(p)
        else:
            M.append(M[-1])
    return sum(m > p for m, p in zip(M, P))


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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]"
    print(solve(N, P))

if __name__ == '__main__':
    main()