Problem:


Score : 300 points

Problem Statement

Given is a permutation P_1, \ldots, P_N of 1, \ldots, N.
Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:  

For any integer j (1 \leq j \leq i), P_i \leq P_j.

Constraints

1 \leq N \leq 2 \times 10^5

P_1, \ldots, P_N is a permutation of 1, \ldots, N.  

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
P_1 ... P_N

Output

Print the number of integers i that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

i=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.

Similarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.

Sample Input 2

4
4 3 2 1

Sample Output 2

4

All integers i (1 \leq i \leq N) satisfy the condition.

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only i=1 satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt
from fractions import gcd
from itertools import permutations

def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas



N = intinput()
# S = input()
# A, B, C, D, E, F = mulinputs()
datas = list(mulinputs())
# datas = lineinputs(input)

M = 1001000
cnt = 0
l = len(datas)
# for i in range(0,N):
#     is_clear = True
#     for j in range(0,(i+1)>>1):
#         dp0 = datas[2*j] if 2*j < l else M
#         dp1 = datas[2*j+1] if 2*j < l else M
#         if dp0 < datas[i]:
#             is_clear = False
#             break
#         if dp1 < datas[i]:
#             is_clear = False
#             break
#     if is_clear:
#         cnt += 1
dmap = dict()
for i in range(1, len(datas)+1):
    dmap[datas[i-1]] = i
counter = N
for i in range(1, len(datas)+1):
    if dmap[i]-1 > counter:
        continue
    counter -= (counter - (dmap[i]-1))
    cnt +=1
    if counter <=0:
        break


# 出力
print(cnt)

Submission status: Accepted

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

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

    if p[i] <= minp:
        minp = p[i]

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

#print(N)
#print(P)

SUCCESS = N
pre_max = P[0]
pre_min = P[0]
for i in range(N):
    j = i - 1

    if pre_min < P[i]:
        SUCCESS -= 1
        continue
    else:
        pre_min = P[i]
print(SUCCESS)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#front small ng
def checkFront(start,a):
  global smallest
  nowIndex = start
  if(a[start] > smallest):
      #print("out")
      return 0
  else:
    smallest = a[start]
    return 1

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

smallest = a[0]
ans = 0

for i in range(n):
  ans += checkFront(i,a)
print(ans)

Submission status: Accepted

Solution code:
m = input()
arr = input().split()
cnt = 0
flg = 1
mnn = arr[0]
for n in arr:
  if(int(n)>int(mnn)):
    continue
  else:
    mnn = n
    cnt = cnt + 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
# result_list = [0]*n
result = 1
com_val = p[0]

for i in range(1, n):
    if com_val < p[i]:
        continue
    else:
        result += 1
        com_val = p[i]

print(result)

Submission status: Accepted

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

islow = True
counter = 0
min = 0

for i in range(len(plist)):
    islow = True
    if i == 0:
        counter += 1
        min = plist[i]
        current_min = i
    elif min > plist[i]:
        counter += 1
        min = plist[i]
        current_min = i
        
print(counter)

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

print(cnt)

Submission status: Accepted

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

cnt = 0
for i,v in enumerate(p):
    if i == 0:
        cnt += 1
        min_ = v
        continue
    if min_ > v:
        min_ = v
        cnt += 1
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
arr=[]
minn=2*(10**5)+1
for i in range(n):
    if a[i]<minn:
        minn=a[i]
    arr.append(minn)
#print(arr)
co=0
for i in range(len(arr)):
    if arr[i]>=a[i]:
        co+=1
print(co)

Submission status: Accepted

Solution code:
n = input()
p = input().split()

i_cnt = 1
current_max = {'idx': 0, 'value': 0}

for j in range(len(p)):
  for i in range(current_max['idx'], j):
    current_max['idx'] = i
    if current_max['value'] <= int(p[i]): 
      current_max['value'] = int(p[i])
    if int(p[i]) < int(p[j]):
      break
    if j-1 == i:
      i_cnt += 1

print(i_cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(raw_input())
array = map(int, raw_input().split())

num = 0
min_num = array[0]

for i in range(0,N):
    if min_num >= array[i]:
        num += 1
        min_num = array[i]

print num

# num = 0
# flag = 0

# for i in range(N):
#     flag = 1
#     for j in range(i):
#         print i,j
#         if array[i] <= array[j]:
#             print "match"
#             continue
#         else:
#             print "break",array[i] , array[j]
#             flag = 0
#             break
#     if flag == 1:
#         print ":",i
#         num += 1

# print num

# num = N

# for i in range(1,N):
#        if array[i-1] < array[i]:
#            num -= 1

# print num

Submission status: Accepted

Solution code:
n = int(input())
list = list(map(int,input().split(" ")))
result = n
tem = list[0]
for i in range(n):
    if tem >= list[i]:
        tem = list[i]
    else:
        result -= 1

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

c = p[0]

for i in range(n):
    #a = p[:i + 1]

    if c >= p[i]:
        c = p[i]
    if c >= p[i]:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
_min = p[0]
for a in p:
    if a > _min:
        n -= 1
    _min = min(a, _min)
print(n)

Submission status: Accepted

Solution code:
n = int(input())
p = [int(e) for e in input().split()]
count=0
p_min=p[0]

for i in range(n):
    if p[i] <= p_min:
        count+=1
#        p_min=min(p[0:i+1])
        p_min=p[i]

print (count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
x = p[0]

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

Submission status: Accepted

Solution code:
from sys import stdin
N=int(input())
P=[int(x) for x in stdin.readline().rstrip().split()]
ans=1
min=P[0]

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

Submission status: Accepted

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

min = 2*10**5 + 1
count = 0

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

print(count)

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

Submission status: Accepted

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

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

        tmp = min(tmp, P[i])
        if P[i] <= tmp:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
loop = int(input())
num_list = list(map(int, input().split()))
ans = 0
min_value = 20000000
for n in num_list:
  flg = True
  if min_value < n:
    flg = False
  else:
    min_value = n
  if flg:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
#C

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

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

Submission status: Accepted

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

ans_ls=[0]
ans=1

for i  in range(1,N):
    if P[ans_ls[-1]]>P[i]:
        ans+=1
        ans_ls.append(i)
    
    '''
    if P[i-1]<P[i]:
        pass
    
    elif P[i-1]>P[i] and ans[-1]==(i-1):
        ans.append(i)
        
    elif ans[-1]==
    '''
    
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
p=map(int,input().split())
mini=n+1
count=0
for x in p:
    if x < mini:
        mini = x
        count = count+1
    if x == 1:
        break
print(count)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = tuple(map(int,input().split()))
    a = 1
    minP = P[0]
    for i in range(1, N):
        if minP < P[i]:
            pass
        else:
            minP = P[i]
            a += 1
    print(a)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*p=map(int,open(0).read().split())
_min=max(p)
cnt=0
for i in p:
  _min=min(_min,i)
  if i>_min:
    cnt+=1
print(n-cnt)

Submission status: Accepted

Solution code:
N=int(input())
data = list(map(int, input().split()))
ans=1
minmin=data[0]
if N==1:
    ans=1
elif N>1:
    minmin=data[0]
    for i in range(1,N):

        if data[i]<=minmin:
            minmin=data[i]
            #if minmin<=data[i]:
            ans+=1
                #continue
        #if minmin<=data[i]:
            #ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

result = 0
last = Pn[0]  # 初期化

for i in Pn:
    if int(last) >= int(i):
        result += 1
        last = int(i)

print(result)

Submission status: Accepted

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

x = P[0]
ans = 0

for i in P:
    if x >= i:
        x = i
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
cnt=1;small=a[0]
for i in range(1,n):
  if a[i]<=small:
    #print(a[i],'--',large)
    cnt+=1
    small=a[i]
    
print(cnt)

Submission status: Accepted

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

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

print(N - NG_count)

Submission status: Accepted

Solution code:
N = int(input())

P_list = input().split()

P_list_int = [int(p) for p in P_list]


correct_cnt = 0
min_val = 200000
for i in range(N):
    if(P_list_int[i] <= min_val):
        min_val = P_list_int[i]
        correct_cnt += 1

print(correct_cnt)

Submission status: Accepted

Solution code:
N = int(input())
tmp = input().split(" ")
l = [int(i) for i in tmp]
ans = 1
ll = list()
ll.append(l[0])
for i in range(1,N):
    ll.append(min(ll[i-1],l[i]))
for i in range(1,N):
  if ll[i-1] > l[i]:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = input()
P = input().split(' ')
count = 0
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
        Pmin = int(Pi)

    elif Pmin>=int(P[i]):
        count = count +1
        Pmin = int(Pi)


print(count)

Submission status: Accepted

Solution code:
total = input()
L = list(map(int, input().split()))
sum=0
Q=0
for i in range(int(total)):
  if i == 0:
    Q=L[i]
    sum = sum  + 1
  else:
    if Q>=L[i]:
      sum = sum  + 1
      Q=L[i]
print(sum)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int, input().split()))
# n=5
# l=[4,2,5,1,3]
count=0

import heapq

tmp=l[0]
for i in range(1,len(l)+1):
    if tmp>=l[i-1]:
        count+=1
        tmp=l[i-1]
    
    
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p_arr = list(map(int, input().split()))
min_i = 9999999999999999999999999
res = 0
for i in p_arr:
  if i == 1:
    res += 1
    break
  else:
    if i < min_i:
      res += 1
      min_i = i
print(res)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
result = [False]*N
count = 0
mn = P[0]
for i in range(N):
    if P[i] <= mn:
        count += 1
        mn = P[i]

print(count)

Submission status: Accepted

Solution code:
import sys

n_in = input()
result = input().split()
total = 0
n_in = int(n_in)
p_min = int(result[0])
for k0 in range(n_in):
    count = 0
    if int(result[k0]) <= p_min:
        total += 1
        p_min = int(result[k0])

print(total)

Submission status: Accepted

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

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

Submission status: Accepted

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


# 最小値更新して越えてたらアウト
resultCount = 0
minNum = P[0]
for i in range(N):
    isMitasu = True
    if i != 0:
        if P[i] > minNum:
            isMitasu = False
        else:
            # 最小値更新
            minNum = P[i]
    if isMitasu:
        resultCount += 1
print(resultCount)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

memo = [0] * N
memo[0] = 1
minn = P[0]
for i in range(1, N):
    if P[i] <= minn:
        memo[i] = 1
    else:
        memo[i] = 0
    minn = min(minn, P[i])
print(sum(memo))

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
input=sys.stdin.readline

n=int(input())
p=list(map(int,input().split()))
P=[]
cnt=0
lowest=float("inf")

for i in p:
    if i<=lowest:
        lowest=i
        cnt+=1

print(cnt)

Submission status: Accepted

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

cnt = 1
m = p[0]

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

Submission status: Accepted

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

Submission status: Accepted

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

minus_count = 0
rember_number = 0
for i, x in enumerate(c_list):
    if i == 0:
        rember_number = x
        continue
    else:
        if x < rember_number:
            rember_number = x
        if x > rember_number:
            minus_count += 1

print(len(c_list) - minus_count)

Submission status: Accepted

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

res = 0
aa = p[0]
for i in p:
     if aa >= i:
         res += 1
         aa = i

print(res)

Submission status: Accepted

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

now = num[0]
cnt = 1
for i in range(1,n):
    if (now > num[i]):
        cnt+=1
        now = num[i]
    
print(cnt)

Submission status: Accepted

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

Max = P[0]
count = 1

for i in range(N-1):
  if P[i+1] < Max:
    count += 1
    Max = P[i+1]
#  print('count=', count, 'Max=', Max)

print(count)

#print('N=', N)
#print('P=', P)

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:
        m=i
        c+=1
print(c)

Submission status: Accepted

Solution code:
import sys

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

ans = 0
max = -1
min = sys.maxsize

for i in range(a):
    
    c = b[i]

    if c <= min:
        min = c

    if c <= max and c <= min or i == 0:
        ans += 1

    if c >= max:
        max = c

print(ans)

Submission status: Accepted

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

pmin = P[0]

m = 1

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

print(m)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
Nflag = 0
count = 0
tmp = float("inf")
for i in P:
    if i<tmp:
        tmp=i
    else:
        count+=1
print(N-count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

max = p[0]
ans = 0

for i, v in enumerate(p):
   if max >= v:
       ans += 1
       max = v

print(ans)

Submission status: Accepted

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

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

if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
p_min = P[0]
for i, j in enumerate(P):
    if p_min >= j:
        ans += 1
        p_min = j

print(ans)

Submission status: Accepted

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

counter=0
flag=True
#最小値
a=x[0]
for i in range(N):

    if a>x[i] :
        a=x[i]
    if a<x[i]:
        counter+=1

print(N-counter)

Submission status: Accepted

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

m = p[0]
ans = 0
for i in range(n):
    if p[i] <= m:
        ans += 1
        m = min(m, 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 = 0
pivot = P[0]

for i in range(0, len(P)):
    if (pivot >= P[i]):
        ans += 1
        pivot = P[i]

print(ans)

Submission status: Accepted

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

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

    if P[i] <= n_p:
        ans += 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import queue
import copy
import math
from collections import deque

# そのまま入力文字列の入力
n = int(input())

# 空白区切りの数値をリスト化
pn = list(map(int, input().split()))

ans = 0
current_min = n + 1

for i in range(0, n):
    if i == 0:
        current_min = pn[i]
        ans += 1
        continue

    if pn[i] < current_min:
        ans += 1
        current_min = pn[i]
        continue

print(ans)

Submission status: Accepted

Solution code:
N= int(input())
P = [int(i) for i in input().split()] 
C = N
D = P[0]
for i in range(1, N, 1):
	D = min(D,P[i])
	if D != P[i]:
		C -= 1
print(C)

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

Submission status: Accepted

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

lim = P[0]+1
ans = 0

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

print(ans)

Submission status: Accepted

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

n = int(input())

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

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

Submission status: Accepted

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

ans = 1
min = p[0]

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

Submission status: Accepted

Solution code:
import numpy as np

N=int(input())

P=np.array(input().split(" "),dtype=np.int32)

count=1

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


print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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


def solve(N: int, P: "List[int]"):
    INF = 1001001
    p_min = INF
    cnt = 0
    for pi in P:
        if p_min < pi:
            continue
        else:
            p_min = pi
            cnt += 1
    print(cnt)
    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()))
ans=0
a=p[0]
for i in range(n):
    if p[i] <= a:
        ans+=1
    
    a=min(a,p[i])    


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#python3
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:
        cnt +=1
        MIN = min(MIN, p[i])

print(cnt)

Submission status: Accepted

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

x=a[0]
y=0
for i in range(N):
  if a[i]<=x:
    y+=1
    x=a[i]
print(y)

Submission status: Accepted

Solution code:
N = int(input())
num = list(map(int,input().split()))
cnt = 0
flag = False
num_min = 10**8
for i in range(N):
	if(i == 0):
		cnt+=1
		continue
	num_min = min(num_min,num[i-1])
	if (num[i] <= num_min):
		cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import heapq
a = []
n = int(input())
p_L = list(map(int,input().split()))


heapq.heapify(a)
kotae = 0
for i in p_L:
    heapq.heappush(a, i)
    if i == a[0]:
        kotae += 1

print(kotae)

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    n = int(lines[0])
    p = [int(e) for e in lines[1].split(' ')]

    return (n, p)


def solve(n, p):


    result = [] 
    current_min = 200000 + 1
    current_min_index = None
    for i in range(n):

        if current_min < p[i]:
            pass
        else:
           current_min = p[i]
           current_min_index = i

        done = False
        for j in range(current_min_index, i+1):
            if p[i] <= p[j]:
                if j == i:
                    done = True
            else:
                break
        if done:
            result.append(i)


    return len(result)


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        print("%d %d" % (result[0], result[1]))
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
arr = [int(j) for j in input().split()]
ma = 99999999999
count = 0
for i in range(n):
	if arr[i] < ma:
		ma = arr[i]
		count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
array = list(map(int, input().split()))
cnt = 1
minv = array[0]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)