Problem:


Score : 300 points

Problem Statement

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

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

Constraints

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

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

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
P_1 ... P_N

Output

Print the number of integers i that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

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

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

Sample Input 2

4
4 3 2 1

Sample Output 2

4

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

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only i=1 satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Accepted

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

result = 1
minP = N

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

print(result)

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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]
        if MIN == 1:
            break
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
p = list(map(int, input().split()))

count = 0
min_p = p[0] + 1
for i in range(0,n):
    if p[i] == 1:
        count += 1
        break
    if min_p > p[i]:
        min_p = p[i]
        count += 1


print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = map(int, input().split())
cmin = N + 1
count = 0
for c in P:
    if c <= cmin:
        count += 1
        cmin = c
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
c = 0
mi = 2*(10**5)
for i in range(n):
    mi = min(mi,a[i])
    if mi >= a[i]:
        c+=1
print(c)

Submission status: Accepted

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

h = []
heapq.heapify(h)
ans=0
for i in range(len(p)):
    heapq.heappush(h,p[i])
    m = heapq.heappop(h)
    if m==p[i]:
        ans+=1
    heapq.heappush(h,m)
print(ans)

Submission status: Accepted

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

min_num = n + 1
count = 0
for i in range(n):
    if min_num > p[i]:
        min_num = p[i]
        count = count + 1
print("{}".format(count))

Submission status: Accepted

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

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
minP = []
ans = 0
for idx, p in enumerate(P):
    if idx == 0:
        minP.append(p)
    else:
        minP.append(min(minP[idx-1], p))

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

print(ans)

Submission status: Accepted

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

a_min = 2*(10**5)
cnt = 0

for i in a:
    if a_min >= i:
        cnt += 1
        a_min = i

print(cnt)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
import sys

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

min_element = sys.maxsize
result = 0
for i in range(len(P)):
    if P[i] <= min_element:
        min_element = P[i]
        result += 1
    else:
        continue

print(result)

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

answer = 0
now_min = 999999
for i in range(len(p_li)):
    if now_min > p_li[i]:
        now_min = p_li[i]
        answer += 1

print(answer)

Submission status: Accepted

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

if n == 1:
    print(1)
    exit()

count = 0
base = P[0]
for i in range(n - 1):

    if base >= P[i + 1]:
        count += 1
        base = P[i + 1]

print(count+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

MIN = P[0]
count = 1
for i, p in enumerate(P[1:]):
    if p <= MIN:
        count += 1

    if p < MIN:
        MIN = p

print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

List=[]
x=P[0]
for i in range(N):
    if x >= P[i]:
        x=P[i]
        List.append(P[i])
    else:
        List.append(x)

ans=1       
for i in range(N-1):
    if List[i] != List[i+1]:
        ans = ans+1

print(ans)

Submission status: Accepted

Solution code:
n = int(raw_input())
arr = [int(x) for x in raw_input().split()] 

count = 0
min_subarr = 2 * 10**5 + 1
for i in range(0, len(arr)):
	if arr[i] < min_subarr:
		min_subarr = arr[i]
		count += 1
print count

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
    else:
        pass
print(cnt)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()

ans = 0
ma = 0
# for i in range(n):
#     flag = True
#     pi = p[i]
#     if ma > pi:
#         flag = False
#         ma = pi
#     # ma = pi
#     # for j in range(i, -1, -1):
#     #     if pi > p[j]:
#     #         flag = False
#     if flag ==True:
#         ans += 1
# print(ans)
ans = 1
m = p[0]
for i in range(1, n):
    if m > min(m, p[i-1]):
        m = min(m, p[i-1])
        # print(m)
    if m >=  p[i]:
        ans += 1
    # m = p[0:i]
    # print(m)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N = map(int, input().split())
nums = list(map(int, input().split()))

minimum = 9999999999
ans = 0

for num in nums:
    if minimum >= num:
        ans += 1
        minimum = num

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
# S = input()
P_list = list(map(int,input().split()))
#print(P_list)
# X2_list = [list(map(int,input().split())) for i in range(N)]
result = 1
tmp = P_list[0]
for i in range(1,N):
     if tmp > P_list[i]:
          result += 1
          tmp = P_list[i]

print(result)

Submission status: Accepted

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

MIN = 10e5
c = 0
for i in range(n):
  if p[i] <= MIN:
    MIN = p[i]
    c += 1
print(c)

Submission status: Accepted

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

min = P[0]
count = 1
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 = list(map(int,input().split()))

M = 0
m = n
count = 0

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

min_n = n+1
ans = 0

for aa in a:
    if min_n > aa:
        ans += 1
        min_n = aa

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

min_num = 10**9
min_l = []
cnt = 0
for i in range(N):
  if P[i] < min_num:
    min_l.append(P[i])
    min_num = P[i]
    cnt += 1
  else:
    min_l.append(min_num)

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
P = [int(i) for i in input().split()]
r = 0
m = n+1
for i in range(n):
    if P[i] < m:
        r += 1
        m = P[i]
print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

bottom = 10 ** 6

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

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

Submission status: Accepted

Solution code:
len_arr = int(input())

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

c = arr[0]
ans = 1
for i in range(1, len_arr):
    c = min(c, arr[i])
    if c == arr[i]:
        ans += 1

print(ans)

Submission status: Accepted

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

v1 = P[0]

count = 1
for v in P[1:]:
    if v1 > v:
        count += 1
        v1 = v

print(count)

Submission status: Accepted

Solution code:
def LI():
  return [int(s) for s in input().split()]
N = int(input())
p_s = LI()

min_j = p_s[0]
count = 1

for i in range(1,N):
  if min_j >= p_s[i]:
    count+=1
    min_j = p_s[i]

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    P_1 = list(map(int, input().split()))
    logging.info("Hello!")

    min_num = 2 * 10 ** 6
    counter_i = 0
    
    for p in P_1:
        if p <= min_num:
            counter_i += 1
            min_num = p

    print(counter_i)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import bisect
n = int(input())
seq = list(map(int,input().split()))
ans=0
s=10**6
for i in range(n):
    if seq[i]<s:
        ans+=1
        s=seq[i]
    else:
        pass
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
tmp = 2**60
ans = 0
for i in input().split(" "):
  tmp = min(tmp,int(i))
  if int(i) == tmp:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys

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

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

ans = N - count
print(ans)

Submission status: Accepted

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

def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    ls = [0 for _ in range(N)]
    ans = 0
    mins = 10**10
    for i in range(N):
        mins = min(mins,P[i])
        if mins==P[i]:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, *p = map(int, open(0).read().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(p) for p in input().split()]
count = 1
minimam = P[0]
for p in P[1:]:
    if p <= minimam:
        count += 1
        minimam = p
print(count)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
s = 10**10
ans = []

for i in range(n):
    if p[i] <= s:
        ans.append(p[i])
        s = p[i]

# print(ans)
print(len(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

m = 10**10

count = 0
for p in P:
    if p <= m:
        count += 1
        m = p

print(count)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding:utf-8

N = int(input())
P = [int(el) for el in input().split(' ')]
min_val = N+1
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
def mainFunc():
    N = int(input())
    arr = list(map(int, input().split(" ")))
    minN = arr[0]
    ans = 0

    for i in range(N):
        if minN >= arr[i]:
            minN = arr[i]
        if minN >= arr[i]:
            ans += 1
    
    print(str(ans))

mainFunc()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
minmemo = [10**6]*(N+1)
for i in range(1,N+1):
    minmemo[i] = min(P[i-1],minmemo[i-1])
    if minmemo[i] >= P[i-1]:
        ans += 1
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
minNum = 10 ** 6
for i in range(1, n + 1):
  if minNum > numList[i-1]:
    minNum = numList[i-1]
    count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n = int(input())
p = list(map(int,input().split(" ")))

m = p[0]
res = 0
for i in p:
    #最小値更新
    if i <= m:
        m = i
    if i == m:
        res += 1
        
print(res)

Submission status: Accepted

Solution code:
import heapq

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
p = list(map(int, input().split()))
count = 0
tmp_min = n
for pi in p:
    if pi < tmp_min:
        tmp_min = pi
    if pi <= tmp_min:
        count += 1
print(count)

Submission status: Accepted

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

ans = 0
minNum = 99999999

for pin in P:
    if pin <= minNum:
        ans = ans + 1
        minNum = pin

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

result = 0
m = None
for p in input().split():
    p = int(p)
    if m is not None:
        if m < p:
            result += 1
    if m is None or p < m:
        m = p

print(N - result)

Submission status: Accepted

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

res = 1
minp = P[0]
for p in P[1:]:
  if p < minp:
    minp = p
    res += 1
print(res)

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

*P,  = map(int, input().split())

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

print(count)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n = INT()
    p = LIST()
    ans = 0

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


if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def solve(nums):
  curr_min = 2 * 10**5 + 1
  ans = 0
  for n in nums:
    if n <= curr_min:
      ans += 1
    curr_min = min(curr_min, n)
  print(ans)

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


N = iin()
nums = iln()
solve(nums)

Submission status: Accepted

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

min = 2*10**5 + 1
ans = 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())
P = list(map(int, input().split()))
PP = [P[0]]
for p in P[1:]:
    PP.append(min(PP[-1], p))
ans = 0
for p, pp in zip(P, PP):
    if pp >= p:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    N = input()
    P = [int(x) for x in stdin.readline().rstrip().split()]

    min_now = P[0]
    count = 0

    for p in P:
        if p <= min_now:
            count += 1
            min_now = p
        else:
            pass

    print(count)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

n = int(input())
p = input().split()

min_n = 2.1 * 10**5
count = 0
for j in range(n):
    if min_n > int(p[j]):
        count += 1
        min_n = int(p[j])
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = map(int,input().split())
res = 0
mi = n+1
for i in l:
    if mi > i:
        res += 1
        mi = i
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#C
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]
    
print(ans)

Submission status: Accepted

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

ans=0
pre=float('inf')
for i in range(n):
       if P[i]<=pre:
              ans+=1
              pre=P[i]
print(ans)

Submission status: Accepted

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

mn = max(A) + 7
c = 0

for i in A:
    if i < mn:
        mn = i
        c += 1
print c

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

        elif P[i] <= min:
            cnt += 1
            min = P[i]
    print(cnt)

ABC152C()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left

N=int(input())
Pn=list(map(int, input().split()))
p_min = [10**5 + 7 for i in range(N+1)]

cnt = 1
p_min[0] = Pn[0]
for i in range(1, N):
    p_i = Pn[i]
    p_j = min(p_i, p_min[i-1])
    p_min[i] = p_j
    if p_i <= p_j:
        cnt += 1
print(cnt)

Submission status: Accepted

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

cur_min = P[0]
ret = 1
for i in range(1, N):
  if P[i] < cur_min:
    cur_min = P[i]
    ret += 1

print(ret)

Submission status: Accepted

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

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

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

print(count)

Submission status: Accepted

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

m = P[0]
c = 1

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

print(c)

Submission status: Accepted

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

tmp_min = n+1
counter = 0
for i in range(n):
    if tmp_min > p[i]:
        tmp_min = p[i]
    if tmp_min < p[i]:
        counter +=1
print(n-counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = [int(e) for e in input().split()]
i_count = 0
min_P = 200001

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

print(i_count)

Submission status: Accepted

Solution code:
def main():
    _ = input() # N
    P = [int(x) for x in input().split()]
    count = 1
    min_num = P[0]
    for p in P[1:]:
        if min_num >= p:
            count += 1
        if p < min_num:
            min_num = p
        
    print(count)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

minP = N + 1
cnt = 0

for p in P:
    if p < minP:
        cnt += 1
        minP = p

print(cnt)

Submission status: Accepted

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

pf = [0]*n
mn = 1e9
for i in range(0,n):
    mn = min(mn,a[i])
    pf[i] = mn
    
cn = 0
for i in range(n):
    if(a[i]<=pf[i]):
        cn += 1
        
print(cn)

Submission status: Accepted

Solution code:
N = int(input())
P = [int(p) for p in input().split()]
m = P[0]
count = 0
for p in P:
    if p <= m:
        count += 1
        m = p

print(count)

Submission status: Accepted

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

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

cnt = 0
min_a  = 10 ** 9
for i in range(N):
  min_a  =  min(min_a,a_list[i])
  if min_a >= a_list[i]:
    cnt += 1
    
print(cnt)

Submission status: Accepted

Solution code:
from math import factorial
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


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


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def MS(): return map(str, input().split())

YN = ['No', 'Yes']
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


# show_flg = False
show_flg = True

p = None
XY = None
N = None


def main():
    N = I()
    P = LI()
    MP = [0] * N
    ans = 0

    for i in range(N):
        if i == 0:
            MP[i] = P[i]
        else:
            MP[i] = min(MP[i-1], P[i])

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

    print(ans)
    # print(MP)
    # print(P)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

cnt = 0
# for i in range(1,N):
#     for j in range(0,i):
#         if A[i] > A[j]:
#             break
#     else:
#         cnt += 1
min_value = A[0]
for i in range(N):
    if min_value >= A[i]:
        cnt += 1
        min_value = A[i]

print(cnt)

Submission status: Accepted

Solution code:

def main():
    _ = input()
    P = [int(x) for x in input().split()]
    # minを保持し続ければよい
    ans = 0
    min_val = P[0]
    for p in P:
        if p <= min_val:
            ans += 1
            min_val = p
    print(ans)


if __name__ == "__main__":
    main()