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())
num = [ int(v) for v in input().split() ]
ans = 0
minn = 10**9
for i in range(n):
    if minn > num[i]:
        minn = num[i]
        ans += 1
print(ans)

Submission status: Accepted

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

min_val = 10**9+7
count = 0
for i in range(n):
    if min_val >= p_list[i]:
        count = count + 1
        min_val = p_list[i]
print(count)

Submission status: Accepted

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

cnt = 0
minval = N+1
for p in P:
  if p <= minval:
    cnt += 1
  minval = min(minval, p)

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

mini =10**9
cnt = 0
for i in range(n):
    if Ps[i] <= mini:
        mini = Ps[i]
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


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

min_p = 2 * 10**5 + 1
cnt = 0
for x in p:
  if min_p >= x:
    cnt += 1
    dprint(x)
  min_p = min(min_p, x)

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
P = [int(p) for p in input().split()]
cur = float('inf')
res = 0
for p in P:
    if p <= cur:
        res += 1
    cur = min(cur, p)
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque
input = sys.stdin.readline
N = int(input())
P = list(map(int,input().split()))
check = P[0]
ans = 0
for i in P:
    if i <= check:
        ans += 1
        check = min(check, i)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
B = [0]*N
B[0] = A[0]
for i in range(1,N):
    B[i] = min(A[i], B[i-1])

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

Submission status: Accepted

Solution code:
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

N = int(input())
A = [int(i) for i in input().split()]
mn = 10000000
ans = 0
for a in A:
	if a <= mn:
		ans += 1
	mn = min(mn,a)
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
P = [int(i) for i in input().split()]
k = N+10
count = 0
for i in range(N) :
    if k >= P[i] :
        k = P[i]
        count +=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0
min_p = float('inf')
for p in pl:
    if p < min_p:
        ans += 1
        min_p = p

print(ans)

Submission status: Accepted

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

Min = 1000000
Sum = 0

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

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

now = p[0]
ans = 1

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

print(ans)

Submission status: Accepted

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

m = P[0]
answer = 1
for p in P[1:]:
    if m > p:
        answer += 1
    m = min(m, p)
print(answer)

Submission status: Accepted

Solution code:
import sys

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

N = ir()
P = lr()
answer = 1
cur = P[0] #現在の最小値
for i in range(1, N):
    x = P[i]
    if cur >= P[i]:
        answer += 1
        cur = P[i]

print(answer)

Submission status: Accepted

Solution code:
INF = int(1e9)

n = int(input())
p = list(map(int, input().split()))
a = INF
ans = 0
for i in range(n):
    if a>=p[i]:
        ans+=1
    else:
        pass
    a = min(a,p[i])
print(ans)

Submission status: Accepted

Solution code:
import sys
from itertools import accumulate

read = sys.stdin.read

N, *P = map(int, read().split())

p = list(accumulate(P, min))

answer = 0
for i, j in zip(P, p):
    if i <= j:
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
import sys

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

def main():
    mi = float('inf')
    res = 0
    for i in range(n):
        if p[i] <= mi:
            res += 1
            mi = p[i]
    return res

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    # a, b = get_inputs(int)
    # A = str(a)*b
    # B = str(b) * a
    # if A < B:
    #     print(A)
    # else:
    #     print(B)
    N = get_input(int)
    P = get_inputs(int)

    P_min = None
    ans = 0
    for i in range(N):
        if P_min is None:
            ans += 1
            P_min = P[i]
            continue

        if P[i] <= P_min:
            ans += 1

        P_min = min(P_min, P[i])
    # print(' '.join(map(str, ans)))
    print(ans)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
p=[int(i) for i in input().split()]
mi=10000000
x=[0]*n
for i in range(n):
    if mi>p[i]:
        x[i]=1
        mi=p[i]

print(sum(x))

Submission status: Accepted

Solution code:
def c_low_elements():
    N = int(input())
    P = [int(i) for i in input().split()]
    minimum = P[0]
    ans = 0
    for p in P:
        if minimum >= p:
            ans += 1
            minimum = p
    return ans

print(c_low_elements())

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

n = int(input())
a = [int(item) for item in input().split()]

minima = a[0]
ans = 0
for item in a:
    if item <= minima:
        ans += 1
        minima = item
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

mini = pn[0]
cnt = 1
for p in pn[1:]:
  if p <= mini:
    cnt += 1
  mini = min(mini, p)
print(cnt)

Submission status: Accepted

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

m = 10 ** 6
cnt = 0
for i in range(N):
    if Ps[i] < m:
        cnt += 1
        m = Ps[i]
print(cnt)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N=ii()
    m = INF
    ans = 0
    for val in mis():
        if m >= val:
            ans += 1
            m = val
    print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
min_val = ps[0]

for i in range(1, n):
	if ps[i] <= min_val:
		cnt += 1
		min_val = ps[i]

print(cnt)

Submission status: Accepted

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

m = n
c = 0
for i in p:
    if m >= i:
        c += 1
        m = i
print(c)

Submission status: Accepted

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

MIN=10**9
ans=0
for p in P:
    MIN=min(MIN,p)
    if p <= MIN:
        ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
P = [int(i) for i in input().split()]
min_v = float("inf")
ans = 0
for p in P:
    min_v = min(min_v, p)
    if p == min_v:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
tmp_min = P[0]

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
minP = N+1

for p in P:
    if (p < minP):
        ans += 1
        minP = p
print(ans)

Submission status: Accepted

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

count = 0

mina = 10**8

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

print(count)

Submission status: Accepted

Solution code:
now_min = 1 << 20

n = int(input())

ans = 0
for p in map(int, input().split()):
    if p < now_min:
        ans += 1
        now_min=p

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
_min = 10**10
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
mae = 10 **9
for i in range(n):
    if mae > p[i]:
        mae = p[i]
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
P=input().split(" ")
P=[int(s) for s in P]
#print(P)
ans=0
curmin=1000000
for i in range(N):
  if P[i]<=curmin:
    ans+=1
    curmin=P[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

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

m = l[0]
cnt = 0
for i in range(N):
    k = l[i]
    if k<=m:
        m = k
        cnt += 1
print(cnt)

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=10**9

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

Submission status: Accepted

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

Submission status: Accepted

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

a, ans = float("inf"), 0
for x in p:
    if a >= x:
        ans += 1
        a = min(a, x)

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
p=list(map(int,input().split()))
mi=float('inf')
ans=0
for i in range(n):
    if p[i]<=mi:
        ans+=1
        mi=p[i]
print(ans)

Submission status: Accepted

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

ans = 0
minP = N + 1
for i, Pi in enumerate(P):
    if Pi <= minP:
        ans += 1
    minP = min(minP, Pi)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 自分より左側には自分より小さい数しかないよってやつを調べる min更新
n = int(input())
arr = list(map(int, input().split()))
ans = 0
tmp = 10 ** 10
for a in arr:
    if tmp >= a:
        ans += 1
        tmp = min(tmp, a)
print(ans)

Submission status: Accepted

Solution code:
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]

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

m = float('inf')
ans = 0
for x in p:
    if x < m:
        ans += 1
        m = x

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
ans=0
p=10**10
for i in l:
    if i<p:
        ans+=1
        p=min(p,i)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

pMin = N+1
ans = 0
for p in Ps:
    if p <= pMin:
        ans += 1
        pMin = p
print(ans)

Submission status: Accepted

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

cnt = 0
a = P[0]
for x in P:
    if x <= a:
        cnt += 1
        a = x

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
m = P[0]
ans = 1
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
m = N + 1

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

print(ans)

Submission status: Accepted

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	P = getlist()
	S = [0] * N
	S[0] = P[0]
	for i in range(1, N):
		S[i] = min(S[i - 1], P[i])
	# print(S)
	ans = 0
	for i in range(N):
		if S[i] >= P[i]:
			ans += 1
	print(ans)
	
if __name__ == '__main__':
	main()

Submission status: Accepted

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


def solve(N: int, P: "List[int]"):
    m = P[0]
    ans = 1
    for p in P:
        if p < m:
            ans += 1
            m = p
    print(ans)

    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:
N=int(input())
P=list(map(int,input().split()))
A=P[0]
cnt=1
for i in range(1,N):
    if P[i]<=A:
        cnt+=1
        A=P[i]
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

lowest = n
ans = 0

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

print(ans)

Submission status: Accepted

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

    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
x,r=3*10**5,0
for a in A:
    if a<=x:
        x,r=a,r+1
print(r)

Submission status: Accepted

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

ans = 0
mini = 10 ** 9

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

print(ans)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = list(map(int, input().split()))
    m = N + 1
    r = 0
    for i in P:
        if i < m:
            r += 1
            m = i
    print(r)
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

N  = input()
A  = list(map(int,input().split()))
min = 10 ** 6
ans = 0 
for a in A:
    if min > a:
        min = a
        ans = ans +1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

res = 0
minn = P[0]
for i, p in enumerate(P):
    if minn >= p:
        res += 1
    minn = min(minn, p)

print(res)

Submission status: Accepted

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

ruiseki = [10**9] * (n + 1)
for i in range(n):
    ruiseki[i + 1] = min(ruiseki[i], p[i])

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

now_min = 10**9
ans = 0
for p in P:
    if p <= now_min:
        ans += 1
        now_min = p

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  ans=1
  a=l[0]

  for x in l[1:]:
    if a>x:
      ans+=1
    if a>x:
      a=x

  return ans

# main()
print(main())

Submission status: Accepted

Solution code:
import sys

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))

n = int(input())
Arr = get_array()
ans = 0
mini = float('inf')
for i in range(n):
    mini = min(mini, Arr[i])
    if Arr[i]==mini:
        ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import fractions
import math
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = IL()

tmp = MAX_INT
ans = 0
for i in range(N):
  if a[i] <= tmp:
    ans += 1
    tmp = a[i]
print(ans)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

ans = 0
top = N*2
for i in range(N):
    top = min(top, A[i])
    if A[i] <= top:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

minimum = float('inf')

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

mn = n
cnt = 0
for e in p:
    mn = min(mn, e)
    if mn >= e:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
min=99999999
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
m = N+1
for i in range(N):
	if P[i] <= m:
		m = P[i]
		ans += 1
print(ans)