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:
'''
条件に合うものを絞り込む
data = [1, 2, 3]
s = [x for x in data if x % 3 == 0]
'''
'''
文字配列を数値に
l_si = ['-10', '0', '100']

l_si_i = [int(s) for s in l_si]
'''
'''
a = [2, 4, 6, 8]
b = [3, 6, 9]

print(list(set(a) | set(b)))  # 和集合
print(list(set(a) & set(b)))  # 積集合
'''
'''
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
while len([x for x in A if x % 2 == 0]) == N:
    A = list(map(lambda y: y / 2, A))
    count += 1
print(count)
'''
'''
.append(要素)
.extend(要素)
.insert(場所,要素)
del 配列名[場所]
-1で末尾で末尾から一つ前
'''
'''
間に空白追加
' '.join(lis)
'''
'''
copy.copy(配列名)
'''
'''
sort()
sorted(reverse=true)
'''
'''
2分探索
bisect.bisect_left(リスト, 要素)
'''
'''
リスト同士の演算
list(map(lambda x, y: x+y, el2, el3))
'''
'''
配列の初期化
配列名=[a]*n+[b]*m
'''
'''
重複
list(set())
２次元配列
list(map(list, set(map(tuple, addition))))
'''
'''
順列
for el in itertools.permutations(配列のパターン):
'''
'''
Decimal()
'''
# 入力 =stdin.readline().rstrip()
# 分割 = stdin.readline().rstrip().split()




from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul
def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


N = int(stdin.readline().rstrip())
P = [int(s) for s in stdin.readline().rstrip().split()]
count = 1
min = P[0]
for k in range(len(P)):
    if k == 0:
        continue
    if min > P[k]:
        count += 1
        min = P[k]
print(count)

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:
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


# 累積最大値で逆から見ていく
N = read_a_int()
P = read_ints()

# from itertools import accumulate

# P_accum = list(accumulate(P, func=max))
# print(P_accum)
# ans = 0
# for i in range(N - 1, 0, -1):
#     print(i, P[i], P_accum[i - 1])
#     if P[i] <= P_accum[i - 1]:
#         ans += 1
# print(ans)
ans = 0
MIN = P[0]
for p in P:
    if MIN >= p:
        MIN = p
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p_list = list(map(int, input().split(" ")))
count = 0
minimum = 10000000
for i in p_list:
    if(i <= minimum):
        minimum = i
        count += 1
print(count)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


#mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
#import numpy as np


def main():
	n=int(input())
	P=list(map(int,input().split()))
	
	a=P[0]
	
	ans=0
	
	for i in P:
		if i<=a:
			ans+=1
			a=i
	
	print(ans)
	
	
	
	
	


if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, P):
    m = INF
    ans = 0
    for i in range(N):
        if P[i] <= m:
            ans += 1
        m = min(m, P[i])
    return ans


def main():
    N = read_int()
    P = read_int_n()
    print(slv(N, P))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


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

    least = 2 * 10 ** 5 + 1
    res = 0

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

    print(res)



main()

Submission status: Accepted

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

mx = 10**8
ans = 0
for i in range(N):
    if P[i] <= mx:
        ans += 1
    mx = min(mx, P[i])

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

a = int(input())
b = list(map(int,input().split()))
inf=float("inf")
b_min = [inf for _ in range(a)]
b_min[0] = b[0]
for i in range(1,a):
    b_min[i] = min(b_min[i-1],b[i])
ret = 0
for i,j in zip(b,b_min):
    if i == j:
        ret+=1
print(ret)

Submission status: Accepted

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

b=[0]*n
mini=float('inf')
cnt=0
for i in range(n):
    mini=min(mini,a[i])
    b[i]=mini
    if a[i]==b[i]:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
point = 0
mi = 10**10
for i in range(n):
    mi = min(li[i],mi)
    if li[i] <=  mi:
        point += 1
print(point)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
P = [int(x) for x in input().split()]
cnt = 1
minP = P[0]
for i in range(1, N):
    if minP >= P[i]:
        cnt += 1
        minP = P[i]

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
A=map(int,input().split())
num=99999999999999999999
count=0
for i in A:
    if i<num:
        count+=1
        #print("aaa")
    num=min(num,i)
print(count)

Submission status: Accepted

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

tmpmin = N+1
ans = 0

for p in Pl:
    if(p<tmpmin):
        ans += 1
        tmpmin = p

print(ans)

Submission status: Accepted

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

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

ans = 1

min_num = p[0]

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

Submission status: Accepted

Solution code:
n = int(input())
p_array = [int(x) for x in input().split()]
now = float("inf")
cnt = 0
for p in p_array:
    if now > p:
        now = p
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
Ans = 0
Min = 9999999

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

print(Ans)

Submission status: Accepted

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

Submission status: Accepted

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


#print(n)
#print(p)


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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
l = [A[0]]
for i in range(1, N):
  if A[i] <= l[-1]:
    l.append(A[i])
print(len(l))

Submission status: Accepted

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

min_v = 10 ** 6
max_v = 0
ans = 0
for i in range(N):
    if P[i] < min_v:
        ans += 1
        min_v = P[i]
    elif P[i] > max_v:
        max_v = P[i]
        
print(ans)

Submission status: Accepted

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

minimun = P[0]
res = 0
for p in P:
    if p <= minimun:
        res += 1
        minimun = p

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from fractions import gcd
from string import ascii_uppercase as ABC
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N = int(input())
min_ = 10**9
P = inpl()
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()))
answer=0
min_num=p[0]
for i in range(n):
    if p[i]<=min_num:
        answer+=1
        min_num=p[i]
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

def solve(N, P):
    min_value = P[0]
    count = 0
    for i in range(N):
        min_value = min(min_value, P[i])
        if P[i] == min_value:
            count += 1
    return count


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = 1
_min = p[0]

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

print(ans)

Submission status: Accepted

Solution code:
import math
import calendar
import fractions
import itertools

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

pmax = []

minimum = p[0]

for i in p:
    minimum = min(minimum, i)
    pmax.append(minimum)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
p=list(map(int,input().split()))
mi=10**9
ma=0
ans=0
for i in range(n):
    #print(ans)
    if mi>p[i]:
        mi=p[i]
        ans+=1
    if ma<p[i] and i!=0:
        ma=p[i]
        continue
print(ans)

Submission status: Accepted

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

m = lp[0]
ans = 0

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

    m = min(lp[i], m)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

mini = N + 1
cnt = 0
for p in P:
    if p <= mini:
        mini = p
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    # S = [x for x in sys.stdin.readline().split()][0]  # 文字列 一つ
    N = [int(x) for x in sys.stdin.readline().split()][0]  # int 一つ
    p_list = [int(x) for x in sys.stdin.readline().split()]  # 複数int
    # grid = [list(sys.stdin.readline().split()[0]) for _ in range(N)]  # 文字列grid
    # grid = [[int(x) for x in sys.stdin.readline().split()]
    #         for _ in range(N)]  # int grid

    logger.debug('{}'.format([N, p_list]))

    ans = 0
    _min = 2 * 10**5 + 1
    for p in p_list:
        if p <= _min:
            ans += 1
            _min = p
    print(ans)


if __name__ == "__main__":
    resolve()

# AtCoder Unit Test で自動生成できる, 最後のunittest.main は消す
# python -m unittest template/template.py で実行できる
# pypy3 -m unittest template/template.py で実行できる

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5
4 2 5 1 3"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4
4 3 2 1"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6
1 2 3 4 5 6"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """8
5 7 4 2 6 8 1 3"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """1
1"""
        output = """1"""
        self.assertIO(input, output)

Submission status: Accepted

Solution code:
def examA():
    N, M = LI()
    if N==M:
        print("Yes")
    else:
        print("No")
    return

def examB():
    A, B = LI()
    if A>B:
        ans = str(B)*A
    else:
        ans = str(A)*B
    print(ans)
    return

def examC():
    N = I()
    P = LI()
    minP = N+1
    ans = 0
    for i in range(N):
        if minP>P[i]:
            minP=P[i]
            ans +=1
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examC()

"""

"""

Submission status: Accepted

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

m = n + 1
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())
lis = list(map(int, input().split()))
cur = 10**7
ans = 0
for item in lis:
  if cur >= item:
    cur = item
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int,input().split()))
ans = 0
g = a+1
for c in b:
  if c < g:
    ans += 1
    g = c
print(ans)

Submission status: Accepted

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

for i in range(1, n):
    q[i] = min(q[i-1], p[i])
    if p[i] <= q[i]:
        count += 1

print(count)

Submission status: Accepted

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

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

# 最小の値を記録していく
minimum = P[0]
count = 0

for p in P:
    if p <= minimum:
        count += 1
        minimum = p

print(count)

Submission status: Accepted

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

N = int(input())
A = map(int, input().strip().split())
min_num = N+1
ans = 0
for a in A:
    if a < min_num:
        ans += 1
        min_num = a
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

c = 0
m = p[0]
for i in p:
    if m >= i:
        c += 1
        m = i

print(c)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

maxP = [p[0]]
for i in range(1, n):
    maxP.append(min(maxP[i - 1], p[i]))


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

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    p = list(map(int, input().split()))
    ans = 0
    minint = p[0]
    maxint = p[0]
    for i in range(n):
        if p[i] > maxint:
            maxint = p[i]
        elif p[i] <= minint:
            ans += 1
            minint = p[i]
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ind = [0]*(n+1)
for i in range(n):
    ind[arr[i]] = i
temp = 100000000
ans = 0
for i in range(1,n+1):
    if ind[i]<temp:
        ans+=1
        temp = ind[i]
print(ans)

Submission status: Accepted

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

cnt = 0
mi = float('inf')
for i in range(n):
    if lst[i] <= mi:
        mi = lst[i]
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

INF = 10 ** 7
minP = [INF] * (N + 1)

for i in range(N):
    minP[i + 1] = min(minP[i], P[i])

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

print(cnt)

Submission status: Accepted

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

ans = 0
MINP = float("inf")
for i in range(N):
    if P[i] <= MINP:
        ans += 1
        MINP = P[i]
    
print(ans)

Submission status: Accepted

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

minp = 10**6
count = 0

for i in P:
    if i <= minp:
        count += 1
        minp = i
        
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
min_p = float("inf")
for p in P:
    min_p = min(min_p, p)
    if p == min_p:
        count += 1

print(count)

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
ans=1
m=P[0]
for i in range(1,N):
  if m>=P[i]:
    ans+=1
    m=P[i]
  else:
    pass
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()
nas = lambda: stdin.readline().split()

n = ni()
p = na()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

    min = 2 * (10 ** 5) + 10
    c = 0
    for i in P:
        if i <= min:
            c += 1
            min = i
    print(c)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    P=list(map(int,input().split()))
    ans=0
    minnum=INF
    for p in P:
        if minnum>=p:
            ans+=1
        minnum=min(minnum,p)
    print(ans)
        
        

if __name__ == '__main__':
    main()

Submission status: Accepted

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

now = p[0]
count = 0
for n in p:
    if n <= now:
        count += 1
        now = n

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
min_num = 3*(10**5)

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

print(ans)

Submission status: Accepted

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

pmin=10**9
answer=0
for p in plist:
  if p<pmin:
    answer+=1
    pmin=p

print(answer)

Submission status: Accepted

Solution code:
def main():

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

    min_v = float('inf')
    ans = 0
    for i in range(N):
        if p[i] <= min_v:
            ans += 1
        min_v  = min(min_v, p[i])
    return ans

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# abc152/abc152_c
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    P = i2nn()
    min_i = P[0]
    cnt = 0
    for i in range(N):
        if min_i >= P[i]:
            min_i = P[i]
            cnt += 1
    print(cnt)
    return

main()

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
p = list(map(int, input().split()))
class BIT:
  def __init__(self, n):
    self.n = n
    self.data = [0] * (n + 1)
    self.el = [0] * (n + 1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.data[i]
      i -= i & -i
    return s
  def add(self, i, x):
    self.el[i] += x
    while i <= self.n:
      self.data[i] += x
      i += i & -i
  def get(self, i, j = None):
    if j is None:
      return self.el[i]
    return self.sum(j) - self.sum(i)
fwk = BIT(N)
res = 0
for i in range(N):
  g = fwk.sum(p[i])
  if g > 0:
    res += 1
  fwk.add(p[i], 1)
print(N - res)

Submission status: Accepted

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

Submission status: Accepted

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


print(ans)

Submission status: Accepted

Solution code:
N = int(input())
table = [int(i) for i in input().split()]
ans = 0
tmp = float("inf")
for i in range(N):
    x = table[i]

    if tmp>x:
        ans+=1
    tmp = min(tmp,x)
print(ans)

Submission status: Accepted

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

m = P[0]

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

print(N - count)

Submission status: Accepted

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

ans = 0
m = 10 ** 10
for i in range(n):
    m = min(m, p[i])
    if m < p[i]:
        continue
    else:
        ans += 1
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


tmp = 0
ans = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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:
#C
N = int(input()) 
P = list(map(int, input().split()))

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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