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:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def main():
    # sys.stdin = open("sample.txt")
    N = Scanner.int()
    P = Scanner.map_int()
    ans = 0
    m = INF
    for i in range(N):
        if m > P[i]:
            ans += 1
        m = min(m, P[i])
    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    m = 10**6
    ans = 0
    for a in A:
        if a <= m:
            m = a
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
n = int(input())
p = [int(_) for _ in input().split()]
c = list(itertools.accumulate(p, func=min))
print(sum(x == y for x, y in zip(p, c)))

Submission status: Accepted

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

_min = 2*(10**5)+1
ans = 0

for n in range(N):
  _ = P[n]
  if _ <= _min:
    ans += 1
    _min = _

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
lt=list(map(int,input().split()))
#print(lt)

temp=0
answer=0

for i in range(N):
    if i==0:
        answer+=1
        temp=lt[i]
    elif temp>=lt[i]:
        answer+=1
        temp=lt[i]
        
print(answer)

Submission status: Accepted

Solution code:
def low_elements(seq):
    count = 1
    m = seq[0]
    for l in range(1, len(seq)):
        if seq[l] <= m:
            count += 1
            m = seq[l]
    return count


n = int(input())
seq1 = list(map(int, input().split()))
print(low_elements((seq1)))

Submission status: Accepted

Solution code:
n = int(input())
ps  = [int(elem) for elem in input().split()]

cnt = 0
for i, p in enumerate(ps):
  if i == 0:
    last = p
    cnt += 1
  else:
    if last > p:
      last = p
      cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num=int(input())
line=input()
line=line.split()
#b=list(map(int,input().split()))
count1=0
num1=200000
for i in range(num):
    if num1>=int(line[i]):
        num1=int(line[i])
        count1+=1
print(count1)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
min_num = 10**18
for p_i in P:
    min_num = min(min_num, p_i)
    if p_i <= min_num:
        count += 1

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    min_a = 10**6
    ret = 0
    for i in range(N):
        if A[i] < min_a:
            ret += 1
            min_a = A[i]
            
    print(ret)
    
solve()

Submission status: Accepted

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

p_min = [0]*N

p_min[0] = N+1
for i in range(1,N):
	p_min[i] = min(p[i-1],p_min[i-1])

ans = 0

for i in range(N):
	if p_min[i] >= p[i]:
		ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, len(P)):
    if minv >= P[i]:
        minv = P[i]
        count += 1

print(count)

Submission status: Accepted

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

n = int(input())
p = list(map(int, input().split()))
tmpmin = 200001
ans = 0 

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
cmin=1e9
ans=0

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

for i in range(len(num)):
    if i ==0:
        count1 +=1
        minv = num[i]
        
    elif minv >= num[i]:
        minv = num[i]
        count1 +=1
print(count1)

Submission status: Accepted

Solution code:
a = int(input())
num = [int(x) for x in input().split()]
ans = 0
biggest = 0

for n in range(len(num)):
    if n == 0:
        ans += 1
        biggest = num[n]
    elif num[n] <= biggest:
        ans += 1
        biggest = num[n]

print(ans)

Submission status: Accepted

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

x = 0
min_now = max(Ps)

for i in range(N):
    if min_now >= Ps[i]:
        x += 1
        min_now = Ps[i]
print(x)

Submission status: Accepted

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

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

Submission status: Accepted

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


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

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

counter = 0
min_num = 1000000

for i in range(N):
    if lst_p[i] <= min_num:
        counter += 1
        min_num = lst_p[i]
    else:
        continue
print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
P = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
N = input()
N = int(N)


min = 0
out = []
list = input().split(" ")
for i in list:
  if min == 0:
    min = int(i)
    out.append(i)
  else:
    if int(i) <= min:
     
      min = int(i)
      out.append(i)
print(len(out))

Submission status: Accepted

Solution code:
n = int(input())
a = input()
l = a.split()
for i in range(0,n):
    l[i] = int(l[i])
dp = []
dp = [1]
for i in range(0,n+1):
    dp.append(0)
m = l[0]
for i in range(1,n):
    if l[i] < m:
        m = l[i]

    if m+1 >l[i]:
        dp[i] = dp[i-1]+1
    else:
        dp[i]=dp[i-1]
print(dp[n-1])

Submission status: Accepted

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

min = N
score = 0
for i in p:
    if i <= min:
        score += 1
        min = i
    else:
        continue

print(score)

Submission status: Accepted

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


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

res=0
minim=PN[0]
for i in PN:
  minim=min(minim,i)
  if minim>=i:
    res+=1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ret)

Submission status: Accepted

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

ans = 0
X = N + 1
for p in P:
    if X > p:
        ans += 1
        X = p
print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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


min = P[0]
count = 1
for x in P[1:]:
  if x <= min:
    min = x
    count += 1
    
print(count)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
p_list = np.array(list(map(int, input().split())))
cnt = 0
minimum = np.inf
for i in range(n):
  pi = p_list[i]
  if minimum > pi:
    cnt += 1
    minimum = pi
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input().strip())

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

i_min = ary[0]
i_max = ary[0]
count = 1
for i in range(1, len(ary)):
    p_i = ary[i]
    if p_i <= i_min:
        i_min = p_i
    if p_i > i_max:
        i_max = p_i
    if p_i <= i_min and p_i <= i_max:
        count += 1
print(count)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
n = [int(x) for x in input().split()]
n=np.array(n)

a=1
pos=0
for i in range(1,N):
    if n[pos] > n[i] :
        a+=1
        pos=i
print(a)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
p = np.array(input().split(), dtype = int)

num = 0
las = 0

for i in range(n):
    if p[las] >= p[i]:
        las = i
        num += 1

print(num)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ret)

Submission status: Accepted

Solution code:
import numpy as np

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

min_ = N+1
ans = 0
for i in range(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()))
ans=0
mini=10e+6
for i in range(N):
    if(mini>P[i]):
        ans+=1
        mini=P[i]
print(ans)

Submission status: Accepted

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

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 accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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

N = INT()
P = LIST()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_ = int(input())
p = list(map(int, input().split()))
cache = 2000000
ans = 0
for i in p:
  if cache > i:
    ans += 1
    cache = i
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import time
n=int(input())
p=list(map(int,input().split()))
max=n+1
sum=0
for i in p:
    if i<max:
        sum=sum+1
        max=i
print(sum)

Submission status: Accepted

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

cnt = 0
m = l[0]
for i in range(n):
    m = min(m, l[i])
    if m>=l[i]:
        cnt += 1

print(cnt)

Submission status: Accepted

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

count = 0 # p_j > p_i である回数
p_length = len(p_list)
p_min = p_list[0] # 現時点での最小値

for i in range(p_length):
    if p_list[i]<=p_min:
        p_min = p_list[i]
        count = count + 1 # カウントを１つ増やす
    else:
        continue

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
line = list(map(int,input().split()))
a = 1
m = line[0]
for i in range(N-1):
    if m >= line[i]:
        m = line[i]

    if m >= line[i+1]:
       a += 1

print(a)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())

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

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

print(count)

Submission status: Accepted

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


def solve(N: int, P: "List[int]"):
    cnt = 1
    min = P[0]
    for i in range(1, N):
        if P[i] <= min:
            cnt+=1
            min = P[i]
    return cnt


# 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]"
    print(solve(N, P))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
_ =input()
a = list(map(int,input().split()))
d = 100000000
ret = 0
for i in a:
  if i < d:
    ret += 1
    d = i
print(ret)

Submission status: Accepted

Solution code:
import math

def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    print(mama(n,p_list))

            
def mama(n,p_list):
    sum = 0
    top = 0
    for p in p_list:
        if sum <= 0:
            sum = sum + 1
            min = p
        else:
            if min >= p:
                sum = sum + 1
                min = p
            else:
                continue
    return sum


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
a = [int(x) for x in input().split()]
count=1
mini=a[0]

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

print(count)

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 = np.count_nonzero(P == Q)
print(answer)

Submission status: Accepted

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

min = n
count = 0

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()))
m = float('INF')
ans = 0

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

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    pp=map(int,input().split())
    l=c=0
    for p in pp:
        if not l or p<l:
            l=p
            c+=1
    print(c)

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import math

v_min = np.inf

def solve(arr):
  global v_min
  count = 0
  for v in arr:
    if v <= v_min:
      count += 1
      v_min = v
  return count

if __name__ == "__main__":
  _n = int(input())
  arr = [int(i) for i in input().split()]
  ans = solve(arr)
  print(int(ans))

Submission status: Accepted

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

m = P[0]
ans = 0

for p in P:
    m = min(m, p)
    if p <= m:
        ans += 1

print(ans)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
import numpy as np

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

res = 0
min_ = 2*10**5

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
n,*p=map(int,sys.stdin.read().split())
c=0
minp=p[0]
for i in p:
  if i<=minp:
    c+=1
    minp=i
print(c)

Submission status: Accepted

Solution code:
num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = list(map(int, num[1].split()))

num_min = num_1[0]
count = 0

for i in range(0,num_0):
  if(num_min >= num_1[i]):
    count = count+1
    num_min = num_1[i]
    
print(count)

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


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


def read_str():
    return input()


def main():
    n = read_int()
    p = read_int_list()
    res = 0
    m = p[0]
    for i in range(n):
      if p[i] <= m:
        res += 1
        print(' i = ', i, file=sys.stderr)
      m = min(m, p[i])
    print(res)


main()

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


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


def read_str():
    return input()


def main():
    n = read_int()
    p = read_int_list()
    res = 0
    m = p[0]
    for i in range(n):
      if p[i] <= m:
        res += 1
      m = min(m, p[i])


    print(res)


main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
問題自体は単純で、配列Pを先頭から見ていき、
見ている箇所より左側（インデックス番号が見ている箇所より小さいもの）が
すべて見ている値よりも大きければ答えをカントアップ。
配列全てを確認し終わった時点の答えを出力すれば良い。

ただし、Pの最大サイズが 2 × 10**5 なので、

for i in range(N):
    for j in range(i):
        if P[i] < P[j]:
            ans +=1
            
などとすると、　N ** 2 ≒ 10 ** 10 となり間に合わない。
ので、以下のソースのように、確認するインデックス（ i )より
左側の最小値を for文を使用せず保持して比較していけば、
計算量が N になるため、十分に間に合う。
"""


def main():
    # 入力の取得
    N = int(input())
    P = list(map(int, input().split()))

    # i = 0 (配列の先頭の値)は常に条件が成立するので、
    # 答えをカウントアップしておき、for文は i = 1から回す。
    ans = 1

    # 見ている箇所より前の部分までの最小値を保持しておく。
    # for文を回し始める時（i = 1 の時）、確認する箇所より左側は
    # インデックスが０の値しかないので、それを最小値として保持しておく。
    min_val = P[0]

    # インデックス１から配列Pを順番に確認していく。
    for i in range(1, N):
        # インデックス i - 1までのうち最小の値と比較
        if P[i] <= min_val:
            # 成立しているので答えをカウントアップ
            ans += 1

            # インデックス i - 1までの最小値よりも小さいので、最小値を更新
            min_val = P[i]

            # 問題文から、Pは１以上の値しかとらず、値の被りがないので、
            # 値；１が出てきたらそれ以降は常にP[i] > 1 となるので比較するだけ無駄。
            # なので、for文を終了させる。（この処理はなくても間に合うはず）
            if min_val == 1:
                break

    # 答えを出力
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = 0
mini = 10000000

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

print(ans)

Submission status: Accepted

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

min = P[0]
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())
a = [int(x) for x in input().split()]
preMin = [a[0]]
for i in range(1,n):
    preMin.append(min(preMin[-1],a[i]))
ans = 1
for i in range(1,n):
    if a[i]<preMin[i-1]:
        ans+=1
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

a_l = [int(x) for x in input().split()]

count = 0
minnum = a_l[0]
for i in range(n):
    if minnum >= a_l[i]:
        minnum = a_l[i]
        count += 1
    else:
        pass
 
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

count = 1	# 一つ目は絶対OK
min = P[0]

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    count = 1
    tmp_min = p_list[0]
    for i in range(1, len(p_list)):
        tmp_min = min(tmp_min, p_list[i])
        if tmp_min == p_list[i]:
            count += 1

    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

b = N + 1
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

min_num = P[0]
cnt = 0
for p in P:
  if p <= min_num:
    cnt+=1
  min_num=min(min_num, p)

print(cnt)