Problem:


Score : 300 points

Problem Statement

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

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

Constraints

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

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

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
P_1 ... P_N

Output

Print the number of integers i that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

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

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

Sample Input 2

4
4 3 2 1

Sample Output 2

4

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

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only i=1 satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Accepted

Solution code:
def myAnswer(N:int,P:list) -> int:
   total = 0
   MIN = 10**10
   for i in range(N):
      MIN = min(MIN,P[i])
      if(MIN>= P[i]):
         total+=1
   return total

def modelAnswer():
   tmp=1
def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(myAnswer(N,P[:]))

if __name__ == '__main__':
   main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = input()
a = [int(i) for i in input().split(" ")]
mi = a[0]
ans = 0

for num,i in enumerate(a):
    if i <= mi: ans += 1
    if i < mi: mi = i

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

l = 0
a = P[0]
for p in P:
    if p <= a:
        a = p
        l += 1
        continue
print(l)

Submission status: Accepted

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

l = []
a = P[0]
for i in range(N):
    if P[i] <= a:
        a = P[i]
        continue
    else:
        l.append(i)
print(N - len(l))

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

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


def solve(N: int, P: "List[int]"):
    c=1
    min_n = P[0]
    for i in range(1,N):
        if P[i]<min_n:
            min_n=P[i]
            c+=1
    print(c)

    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:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    P=[int(_) for _ in input().split()]
    count=0
    min_p=10**6
    for i in range(n):
        if min_p>P[i]:
            count+=1
            min_p=P[i]
    print(count)

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

res = 10e9
ans = 0
for p in P:
    if (res > p):
        res = p
        ans += 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

p_min = Pn[0]
count = 0
for i in Pn:
    if i <=p_min:
        count += 1
    p_min = min(p_min, i)
print(count)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
cmin = P[0]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math

n = int(input())
pL = list(map(int, input().split(" ")))

mi = pL[0]
cnt = 1

for i in range(1, len(pL)):
    if pL[i] < mi:
        cnt += 1
        mi = pL[i]

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

minval = p[0]
count = 0
for i in p:
    if(i <= minval):
        count = count + 1
    if(minval > i):
        minval = i

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
p = list(map(int, input().split()))
num = p[0]
cnt = 1
for i in range(n - 1):
    if p[i + 1] <= num:
        cnt += 1
        num = p[i + 1]
    else:
        continue
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int,input().split(' ')))
count = 1
i = 1
Pmin = P[0]
while i < n:
    if Pmin == 2:
        count += 1
        break
    elif P[i] < Pmin:
        count += 1
        Pmin = P[i]
    i += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

Solution code:
n = int(input())
p_list = [int(s) for s in input().split()]

p_max = max(p_list) + 1
p_min = p_max

count = 0
for p in p_list:
    if p <= p_min:
        count += 1
        p_min = p
print(count)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
ans = 0
minp = 200000


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

print(ans)

Submission status: Accepted

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


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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


N=input1()
p=input_array()
count=0
min_int=0
for i in range(N):
	num=p[i]
	if i==0:
		min_int=num
		count+=1
	elif num<=min_int:
		min_int=num
		count+=1
		
print(count)

Submission status: Accepted

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

cnt = 0
tmp_min = max(lst)
for i in range(len(lst)):
    num = lst[i]
    if num <= tmp_min:
        cnt += 1
        tmp_min = num

print(cnt)

Submission status: Accepted

Solution code:
import os

def main():
	count = int(input())
	num_p = list(map(int, input().split()))
	ans_list = []
	ans_list.append(num_p[0])
	min_num = ans_list[0]
	for i in range(1,len(num_p)):
		if min_num > num_p[i]:
			ans_list.append(num_p[i])
			min_num = num_p[i]
		else:
			pass
	print(len(ans_list))


if __name__ == '__main__':
	main()

Submission status: Accepted

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

    ans = 1
    min_val = P.pop(0)
    for p in P:
        if p <= min_val:
            ans += 1
            min_val = p

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque

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

mx = P[0]
mn = mx
count = 0

ans = deque(list(filter(lambda x:mx >= x,P)))

ln = len(ans)

for a in range(ln):
    num = ans.popleft()
    if mx >= num:
        mx = num
        count += 1
    else:
        continue

print(count)

Submission status: Accepted

Solution code:
from collections import deque

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

mx = P[0]
mn = mx
count = 0

cut = deque(list(filter(lambda x:mx >= x,P)))
ans = deque()

ln = len(cut)

for a in range(ln):
    num = cut.popleft()
    if mx >= num:
        mx = num
        count += 1
    else:
        continue

print(count)

Submission status: Accepted

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

mi_p=1000000
count = 0
for p in p_list:
    if p < mi_p:
        count = count + 1
        mi_p = p

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 0
min = 200005

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()))
c = 0
m = N+1
for i in range(N):
    if P[i] <= m:
        c += 1
    m = min(P[i], m)
print(c)

Submission status: Accepted

Solution code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
p=n1()
m=p[0]
c=1
for i in range(1,n):
    a=p[i]
    if m>=a:
        c+=1
        m=a
print(c)

Submission status: Accepted

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

mv_left = [float("inf")] * n
for j in range(n):
    if j == 0:
        mv_left[j] = p[j]
    else:
        mv_left[j] = min(p[j], mv_left[j - 1])

# print(p)
# print(mv_left)

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

Submission status: Accepted

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

s = 10**18
ans = 0

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

Submission status: Accepted

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

ans = 0

i = 0
while i < n:
  if i == 0:
    min_n = ps[0]
    ans += 1
  else:
    if min_n >= ps[i]:
      min_n = ps[i]
      ans += 1
  i += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_ = input()
*p, = map(int, input().split())
ans = 1
mn = p[0]
for i in p[1:]:
    if i < mn:
        ans += 1
        mn = 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 range(N):
	if p[i]<=min:
		min=p[i]
		cnt+=1
	
print(cnt)

Submission status: Accepted

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

ans = 1
low = P[0]

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
mini = P[0]

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

load()

A = load_list()
mn = A[0]

cnt = 0
for i in range(len(A)):
    if A[i] <= mn:
        cnt += 1
        mn = A[i]

print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

counter = 1
minimum = lst[0]
for i in range(1, n):
  if minimum > lst[i]:
    minimum = lst[i]
    counter += 1
print(counter)

Submission status: Accepted

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

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


    # lists_slice = lists[:i+1]
    # lists_min = min(lists_slice)
    # if lists_min >= lists[i]:
    #     count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

min_temp = N
counter = 0

for i in range(P.index(1)+1):
    if P[i] <= min_temp:
        min_temp = P[i]
        counter += 1

print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

r=1
min=a[0]

for i in range(1,n):
    if a[i] > min:continue
    else:
        r+=1
        min=a[i] 
    

print(r)

Submission status: Accepted

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

ans = 0
minX = N + 1
for p in P:
    if p < minX:
        ans += 1
    minX = min(minX, p)
print(ans)

Submission status: Accepted

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

min_max = p[0]
count = 1

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

print(count)

Submission status: Accepted

Solution code:
n = int(input());

v = (int(i) for i in input().split());

mn = n + 1;
res = 0;

for i in v:
    res += (mn >= i);
    mn = min(mn, i);

print(res);

Submission status: Accepted

Solution code:
n = int(input())
P = [int(x) for x in input().split()]
m = n + 1
res = 0
for p in P:
  if p < m:
    res += 1
  m = min(m, p)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
P = np.array(input().split(),np.int32)

Q = np.minimum.accumulate(P)
cnt = np.count_nonzero(P==Q)

print(cnt)

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:

x = int(input())
li = list(map(int, input().split()))

a = 0
Min = li[0]
for i in range(len(li)):
    if li[i] <= Min:
        Min = li[i]
        a += 1
print(a)

Submission status: Accepted

Solution code:
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
P = np.array(lr())
Q = np.minimum.accumulate(P)
answer = (P == Q).sum()
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*p=map(int,open(0).read().split());c=0
for q in p:c+=q<=n;n=min(n,q)
print(c)

Submission status: Accepted

Solution code:
n = int(input())
p = [int(i) for i in input().split()]
c = 0
minp = p[0]
for pi in p:
    if pi < minp:
        minp = pi
        c += 1
print(c+1)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for i in p:
    if i <= min_num:
        count += 1
        min_num = i


print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())
p = list(map(int,input().split()))
ans = 0
currentMin = 10 ** 9
s = []

for i in range(n):
    if currentMin > min(currentMin,p[i]):
        currentMin = min(currentMin,p[i])
        s.append(currentMin)
    else:
        s.append(currentMin)

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
l = list(map(int, input().split()))
ans = 1
min = l[0]
for i in range(1, n):
    if min > l[i]:
        ans += 1
        min = l[i]
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
l = list(map(int, input().split()))
ans = 1
min_l = l[0]
for i in range(1, n):
    if min_l > l[i]:
        ans += 1
        min_l = l[i]
print(ans)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

min=1000000000
minnum=[]
for n in range(N):
	if P[n]<=min:
		minnum.append(1)
		min=P[n]
print(sum(minnum))

Submission status: Accepted

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

min_P = P[0]

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

print(ans)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    p = tuple(map(int,input().split()))
    mn = 10**10
    ans = 0
    for i in p:
        if i<mn:
            ans+=1
            mn = i
    print(ans)
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

min_i=[x[0]]
for i in range(1,n):
  min_i.append(min(min_i[i-1],x[i]))
  
count=0
for i in range(1,n):
  if min_i[i-1]<x[i]:
    count=count+1
    
print(n-count)

Submission status: Accepted

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

min_i=[x[0]]
for i in range(1,n):
  min_i.append(min(min_i[i-1],x[i]))
  
count=0
for i in range(n):
  if min_i[i]==x[i]:
    count=count+1
    
print(count)

Submission status: Accepted

Solution code:
n,*p=map(int,open(0).read().split())
m=n+1
ans=0
for x in p:
  if m>x:
    ans+=1
    m=x
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

mn=0
cnt=0

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

# 2重ループにすると楽に書けるが計算量が10^10になり厳しいので、
# min_i[i] = (x[0]～x[i]の中での最小値) という配列をつくった

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

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1

print(n-count)

Submission status: Accepted

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

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

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1

print(n-count)

Submission status: Accepted

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



min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n):
    if min_i[i-1] < x[i]:
        count=count+1
#  if x[i-1]>=x[i]:
#    count=count+1
    
#if min(x)==x[n-1]:
#  count=count+1
print(n-count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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