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:
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n = ii()
    L = lmi()
    current_min = float('inf')
    cnt = 0
    for elm in L:
        if elm <= current_min:
            cnt += 1
            current_min = elm
    print(cnt)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline())
li = list(map(int, sys.stdin.readline().split()))
min = li[0]
cnt = 0
for i in li:
  if i < min:
    cnt += 1
    min = i
  elif i == min:
    cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Main(N, P):
    ans = 1
    mi = P[0]
    for i in range(1, N):
        if mi > P[i]:
            ans += 1
            mi = P[i]
    return ans

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
#n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
count = 1
for i in range(1, n):
    if a[i-1] >= a[i]:
        count += 1
    else:
        a[i] = a[i-1]

print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
ans = [10**6]
for i in P:
    if i < ans[-1]:
        ans.append(i)
print(len(ans)-1)

Submission status: Accepted

Solution code:

import sys
input=sys.stdin.buffer.readline

import numpy as np

N = int(input())
L=list(map(int,input().split()))
P = np.array(L,np.int32)
# 累積の比較
Q = np.minimum.accumulate(P)
answer = np.count_nonzero(P <= Q)

print(answer)

Submission status: Accepted

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

ans = 0
temp = 2*(10**5)+1
for i in s:
    if i <= temp:
        ans += 1
    temp = min(temp,i)
    
print(ans)

Submission status: Accepted

Solution code:
def main2():
    input()
    t = list(map(int, input().split()))
    count = 0
    m = t[0]
    for val in t:
        if val <= m:
            count += 1
            m = val
    print(count)


if __name__ == '__main__':
    main2()

Submission status: Accepted

Solution code:
N = int(input())

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

cnt = 0
min_num = P[0]
for num in P:
  if num == min_num:
    cnt += 1
  elif num < min_num:
    cnt += 1
    min_num = num
  
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
p_min = p[0]
p_sum = 1

# リストの前から最小値を検索
for i in range(1, n):
    
    # 最小値を見つけた場合
    if p_min > p[i]:
        p_sum += 1
        # 最小値を更新
        p_min = p[i]

print(p_sum)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
mini = p[0]
ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc152/tasks/abc152_c

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

mini = p[0]
count = 0
for i in range(len(p)):
    if mini >= p[i]:
        mini = p[i]
        count +=1

print(count)

Submission status: Accepted

Solution code:
N = int(input())
alist = list(map(int,input().split()))
p = 10**6
q = 0
for i in range(N):
    if p > alist[i]:
        q = q+1
        p = min(p,alist[i])
print(q)

Submission status: Accepted

Solution code:
n=int(input())
p=[int(i) for i in input().split()]
cp=[0]*n
cp[0]=p[0]
for i in range(1,n):
  cp[i]=min(cp[i-1],p[i])
c=0
for i in range(n):
  if cp[i]>=p[i]:
    c+=1
print(c)

Submission status: Accepted

Solution code:
num=int(input())
array=list(map(int,input().split()))
counter=0
min_flag=array[0]
for i in range(num):
  if min_flag>=array[i]:
    counter+=1
    min_flag=array[i]
print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

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


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

    N = ii()
    P = il()
    ret = 0
    mi = P[0]
    for n in range(N):
        if mi >= P[n]: ret += 1
        mi = min(mi, P[n])
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())
P = list(map(int, input().split()))
cnt = 0
tmp = 10 ** 10

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
p = [int(x) for x in input().split()]
a = [0]*N
a[0] = p[0]
for i in range(1,N):
    a[i] = min(a[i-1],p[i])
ans = 0
for i in range(N):
    if a[i] >= p[i]:
        ans += 1
print(ans)

Submission status: Accepted

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

tmp = 10 ** 10
count = 0
for i in range(N):
    if tmp >= L[i]:
        count += 1
    tmp = min(tmp, L[i])
        
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

m = 10**6
c = 0

for i in range(0,len(A)):
    if m >= A[i]:
        m = A[i]
        c += 1

print(c)

Submission status: Accepted

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

min = 10**6
count = 0

for i in range(0,len(A_list)):
    if min >= A_list[i]:
        min = A_list[i]
        count += 1

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import deque
N = int(input())
P = list(map(int, input().split()))

d = deque(P)
count = 1

for i in range(1, N):
    if (d[0] >= d[1]):
        d.popleft()
        count += 1
    else:
        d1 = d.popleft()
        d2 = d.popleft()
        d.appendleft(d1)

print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = [int(p) for p in input().split()]
    mi = N + 1
    cnt = 0
    for i in range(N):
        if P[i] < mi:
            mi = P[i]
            cnt += 1
    print(cnt)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

cnt = 1
min_num = p_list[0]

for i in range(1, N):
    if p_list[i] <= min_num:
        cnt += 1
        min_num = p_list[i]

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

MIN = 10**6
ans = 0
for i in range(n):
    if p[i] <= MIN:
        ans += 1
    MIN = min(MIN, p[i])

print(ans)

Submission status: Accepted

Solution code:
#152 Low Elements
n = int(input())
seq = list(map(int,input().split()))
c = []
cnt = 0
for i in range(n):
    if i == 0:
        cnt+=1
        c.append(seq[0])
    else:
        if c[-1] >= seq[i]:
            cnt += 1
            c.append(seq[i])
        
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
ans = 1
p_min = p[0]
i = 1
while i <= n-1:
    if  p_min >= p[i]:
        p_min = p[i]
        ans += 1
        i += 1      
    else:
        i += 1
print(ans)

Submission status: Accepted

Solution code:
stdin = open(0).read().split('\n')
N = int(stdin[0])
P = list(map(int,stdin[1].split()))
ans = 0
min = P[0]
for i in range(N):
    if min >= P[i]:
        ans +=1
        min = P[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

res = 1
target = p[0]
for i in range(1, n):
    if target > p[i]:
        res += 1
        target = p[i]
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# cook your dish here
n=int(input())
a=list(map(int,input().split()))
st=[]
ans=0
for i in range(n):
    if i==0:
        st.append(a[i])
        ans+=1
    else:
        if st[-1]>=a[i]:
            ans+=1
            st.append(a[i])
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
P = rl()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    P = input([int, N])
    min_, count = P[0], 1
    for p in P[1:]:
        if p < min_:
            count += 1
            min_ = p
    print(count)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0;
min_ = 2 * (10 ** 5);

for i in range(n):
  min_ = min(A[i], min_);
  if min_ == A[i]:
    ans += 1;
  else:
    pass;
print(ans);

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

min_num=p_inputs[0]
ans=0

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

Submission status: Accepted

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

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

print(answer)

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:
from collections import defaultdict

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

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

Submission status: Accepted

Solution code:
import sys

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

def main():
    m = float('inf')
    cnt = 0
    for x in p:
        if x > m: continue
        cnt += 1
        m = x
    print(cnt)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
minut = 3*10**5
for i in range(len(P)):
  m = P[i]
  if m < minut:
    minut = m
  if m == minut:
    count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def number(l):
  count=0
  mini=l[0]
  for i in range(n):
    if l[i]<=mini:
      mini=l[i]
      #miniはi-1番目のうち最も小さい値であるから、これより小さかったら、i-1番目のどれよりも小さい
      count+=1
  return count

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

Submission status: Accepted

Solution code:
def number(m,l):
  count=0
  mini=l[0]
  for i in range(m):
    if l[i]<=mini:
      mini=l[i]
      #miniはi-1番目のうち最も小さい値であるから、これより小さかったら、i-1番目のどれよりも小さい
      count+=1
  return count

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

Submission status: Accepted

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

count = 0
mn = float('inf')
for i in range(N):
    if mn >= arr[i]:
        count += 1
        mn =min(mn,arr[i])

print(count)

Submission status: Accepted

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

mn=pl[0]

mnl=[]
count=1
for i in range(n):
    mn=min(mn,pl[i])
    mnl.append(mn)

for i in range(1,n):
    if pl[i]<=mnl[i-1]:
        count+=1
print(count)

Submission status: Accepted

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

L=[P[0]]
if N>1:
  maxvalue=[L.append(min(L[-1],P[i])) for i in range(1,N)]
print(sum([1 if L[i]==P[i] else 0 for i in range(N)]))

Submission status: Accepted

Solution code:
n = int(input())
List = list(map(int,input().split()))
x = 0
min = List[0]
count = 0
#print(List.index(n))
#print(List[0:n])
#print(List[2])

for i in List:
    x = 0
    if i <= min:
        count += 1
        min = i

#print(x)
print(count)

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

min=10000000000
ans=0
       
for i in p:
  if i <= min:
    ans+=1
    min=i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
mn = 200001
for a in P:
    if a < mn:
        cnt += 1
        mn = a
print(cnt)

Submission status: Accepted

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

min=1000000000
ans=0

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

Submission status: Accepted

Solution code:

#C

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

mini = N+1
idx = []
for i in range(N):
  if mini>P[i]:
    mini = P[i]
    idx += [i+1]
print(len(idx))

Submission status: Accepted

Solution code:
count = 0

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

min = 10**7
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(int, input().split()))
mi = float('inf')
cnt = 0
for p in P:
    if p <= mi:
        mi = p
        cnt += 1
print(cnt)

Submission status: Accepted

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

ans=0
flag=10**7
for i in range(n):
    if p[i]<flag:
        ans+=1
        flag=p[i]
print(ans)

Submission status: Accepted

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

P = FLI()

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

Submission status: Accepted

Solution code:
def main():
  n = int(input())
  l = list(map(int, input().split()))
  lowest = 2 * (10**5)
  ans = 0
  for i in l:
    if i <= lowest:
      lowest = i
      ans += 1
  print(ans)
  
if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
def q3():
    N = int(input())
    P = [int(i) for i in input().split()]
    ans = 0
    min_p = P[0]
    for i in range(N):
        if P[i] <= min_p:
            min_p = P[i]
            ans += 1
    print(ans)


if __name__ == '__main__':
    q3()

Submission status: Accepted

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

minv = 10 ** 9
ans = 0

for i in P:
    if i < minv:
        ans += 1
        minv = i

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
pn = list(map(int, input().split()))
min_num = 10**6
counter = 0

for i in range(n):
   if pn[i] <= min_num:
      min_num = pn[i]
      counter += 1
      
print(counter)

Submission status: Accepted

Solution code:
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''
N = int(input())
arr = list(map(int,input().split()))
add = 1000000
cnt = 0
for i in range(N):
	if add>arr[i]:
		cnt+=1
		add = arr[i]
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#定数
#1≦n≦2*10^5
n = int(input())
P = list(map(int, input().split())) #O(n)

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

Submission status: Accepted

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

current_min = float('inf')
cnt = 0
for i in range(N):
    if P[i] <= current_min:
        cnt += 1
        current_min = P[i]

print(cnt)

Submission status: Accepted

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

num = p[0]
ans = 1
#res = []
# res.append(num)
for i in range(1, n):
    if num >= p[i]:
        ans += 1
        num = p[i]
#        res.append(num)

# print(res)
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
count=0
for i,p in enumerate(P):
    if i ==0:
        min_num=p
        count += 1
        continue
    if p <= min_num:
        min_num = p
        count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
x = 1 # i=jを入れる
i = 1
tmp = p[0]
for i in range(n):
    if p[i] < tmp: 
      tmp=p[i]
      x+=1
print(x)

Submission status: Accepted

Solution code:
import sys

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

    if len(p) <= 1:
        print(ans)
        return
    
    min_so_far = p[0]

    for i in range(1, len(p)):
        if p[i] > min_so_far:
            continue
        else:
            min_so_far = p[i]
            ans += 1
    
    print(ans)
    



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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
m = P[0]

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = map(int, input().split())
minimal = float('inf')
ans = 0
for i in P:
    if minimal >= i:
        ans += 1
        minimal = i
print(ans)

Submission status: Accepted

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

M = N+1
ans = 0

for i in range(1, N+1):
  if M > A[i-1]:
    M = A[i-1]
    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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