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 = [int(p) for p in input().split()]

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

ans = 0

if N == 1:
    ans = 1
    print(ans)
    exit(0)

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())
a = list(map(int,stdin.readline().split()))
m = a[0]
c = 0
for i in a:
	m = min(i,m)
	if i <= m:c -= -1
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

now = 0
ans = 1
for i in range(1,n):
    if P[now] > P[i]:
        ans += 1
        now = i
    else:
        pass

print(ans)

Submission status: Accepted

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

count = 0
minimun = 2 * (10**5)+1

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#n,m = map(int,input().split())
lst1 = list(map(int,input().split()))
ans = 0

leftmin = 10**9

for i in range(n):
    if leftmin >= lst1[i]:
        ans += 1
    leftmin = min(leftmin,lst1[i])

print(ans)

Submission status: Accepted

Solution code:
INF = 10 ** 9
N = int(input())
p = list(map(int, input().split()))
cnt = 1
minlst = [INF] * N
minlst[0] = p[0]
for i in range(1, N):
    minlst[i] = min(minlst[i - 1], p[i])

for i in range(1, N):
    if minlst[i] >= p[i]:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

before_min = P[0]
kosuu = 0

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

print(kosuu)

Submission status: Accepted

Solution code:
n = int(input())
p_array = map(int, input().split())
p_min = float("inf")
count = 0
for p in p_array:
    if p_min < p:
        continue
    count += 1
    p_min = p
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

num = 1000000
count = 0

for i,p in enumerate(p_list):
    if p < num:
        num = p
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict
import bisect
from fractions import Fraction

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

min_num = P[0]

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

print(ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

min = P[0]
# print(N,P,min)
result = 0
for pi in P:
    if pi <= min:
        result += 1
        min = pi
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    N, *P = map(int, open(0).read().split())
    
    ans = 0
    tmp = 10 ** 6
    for i in range(N):
        tmp = min(tmp, P[i])
        if P[i] <= tmp:
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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


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


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()))
m = [max(p) + 1]
for pi in p:
    m.append(min(m[-1], pi))
ans = 0
for i in range(n):
    if m[i] >= p[i]:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

min_p = p_list[0]
count = 0
for p in p_list:
    if p <= min_p:
        count += 1
        min_p = p
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):
    if i != 0:
        minp = min(minp,P[i])
    if minp == P[i]:
        ans += 1

print(ans)

Submission status: Accepted

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

now = N+1

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

Submission status: Accepted

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

min_v = float("inf")
ans = 0
for i in range(len(p)):
    if min_v >= p[i]:
        ans += 1
    min_v = min(min_v, p[i])
print(ans)

Submission status: Accepted

Solution code:
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

n = I()
p = LI()

ans = 1

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

print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = input().split()
b = [int(i) for i in b]

miner = b[0]
count = 1
for i in b[1:]:
    if i <= miner:
        miner = i
        count += 1

print(count)

Submission status: Accepted

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

past_min = 10 ** 15
answer = 0

for i in range(N):
  if A[i] <= past_min:
    answer += 1
    past_min = A[i]
    
print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

m = N + 1
res = 0

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

print(res)

Submission status: Accepted

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

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

inf = 10 ** 10

min_p = inf
ans = 0
for p in P:
    if p <= min_p:
        ans += 1
        min_p = p

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from copy import deepcopy
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = float('INF')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


class BIT:
    def __init__(self, size):
        self.bit = [0] * size
        self.size = size
        self.total = 0

    def add(self, i, w):
        x = i + 1
        self.total += w
        while x <= self.size:
            self.bit[x - 1] += w
            x += x & -x
        return

    def sum(self, i):
        res = 0
        x = i + 1
        while x:
            res += self.bit[x - 1]
            x -= x & -x
        return res


n = I()
P = LI()
bit = BIT(n + 1)
cnt = 0
for i in range(n):
    if not bit.sum(P[i] - 1):
        cnt += 1
    bit.add(P[i], 1)


print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(n, p_list):
    p_list_cum_min = [0] * n
    p_list_cum_min[0] = p_list[0]
    for i in range(1, n):
        p_list_cum_min[i] = min(p_list[i], p_list_cum_min[i - 1])

    res = 0
    for i in range(n):
        if p_list[i] <= p_list_cum_min[i]:
            res += 1

    return res


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


def test():
    assert solve(5, [4, 2, 5, 1, 3]) == 3
    assert solve(4, [4, 3, 2, 1]) == 4
    assert solve(6, [1, 2, 3, 4, 5, 6]) == 1
    assert solve(8, [5, 7, 4, 2, 6, 8, 1, 3]) == 4
    assert solve(1, [1]) == 1


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    max_P = P[0]
    min_P = P[0]
    ret = 0
    for i in range(N):
        if min_P >= P[i]:
            ret += 1
            min_P = P[i]
    return ret


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

Submission status: Accepted

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

imin = 2*(10**5) + 1
counter = 0

for i in range(len(p)):
    if imin > p[i]:
        counter += 1
        imin = p[i]

print(counter)

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

class BIT:
    """ Binary Indexed Tree """

    def __init__(self, n):
        # 0-indexed
        nv = 1
        while nv < n:
            nv *= 2
        self.size = nv
        self.tree = [0] * nv

    def sum(self, i):
        """ [0, i]を合計する """
        s = 0
        i += 1
        while i > 0:
            s += self.tree[i-1]
            i -= i & -i
        return s

    def add(self, i, x):
        """ 値の追加：添字i, 値x """
        i += 1
        while i <= self.size:
            self.tree[i-1] += x
            i += i & -i

    def get(self, l, r=None):
        """ 区間和の取得 [l, r) """
        # 引数が1つなら一点の値を取得
        if r is None: r = l + 1
        res = 0
        if r: res += self.sum(r-1)
        if l: res -= self.sum(l-1)
        return res

N = INT()
A = LIST()

bit = BIT(N+1)
ans = 0
for i in range(N):
    # 自分より左にある、自分より小さな数の個数
    if bit.sum(A[i]) == 0:
        ans += 1
    bit.add(A[i], 1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


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

mn=10**20

ans=0

for i in range(n):
	mn=min(mn,a[i])
	if(mn==a[i]):
		ans+=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

c = 0
nowmin = 2*(10**5)+1

for i in P:
  if nowmin >= i:
    c += 1
    nowmin = i
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

min_tmp = P[0]
for i in range(n):
    # print(min_tmp, P[i])
    if min_tmp >= P[i]:
        counter += 1
        min_tmp = P[i]

print(counter)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
MIN = 10**8
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()))

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n=int(input())
lst=list(map(int, input().split()))
ans=0
min=n+1

for i in lst:
    if min>i:
        min=i
        ans+=1

print(ans)

Submission status: Accepted

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

min = 1000000
count = 0
for i in P:
    if min >= i:
        count += 1
        min = i
    else:
        continue
print(count)

Submission status: Accepted

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()
INL=LI()
MM=10**15
cnt = 0
for i in range(N):
    if INL[i] <= MM: cnt += 1
    MM=min(MM,INL[i])
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    m = INF
    ans = 0
    for i in range(n):
        if m >= v[i]:
            ans += 1
            m = v[i]
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*p=map(int,open(0).read().split())
ans,mini=0,p[0]
for i in p:
    if i<=mini:
        ans+=1
        mini=i
print(ans)

Submission status: Accepted

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

min_ = N
cnt = 0
for p in P:
    if p <= min_:
        min_ = p
        cnt += 1
print(cnt)

Submission status: Accepted

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

ans = 0
min_num = P[0]
for p in P:
    if min_num >= p:
        ans += 1
        min_num = p
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
x = 10 ** 6
for i in range(N):
  x = min(x, P[i])
  if x == P[i]:
    count += 1
    #print(i)
print(count)

Submission status: Accepted

Solution code:
from operator import itemgetter
from math import log,ceil

def main():
    N = int(input())
    P = list(map(int,input().split()))
    mini = P[0]
    cnt = 0
    for p in P:
        if p <= mini:
            cnt += 1
        mini = min(p,mini)
    print(cnt)
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
cnt = 0
min_n = 10**9
for num in A:
  if min_n > num:
    cnt += 1
  min_n =min(min_n, num)

print(cnt)

Submission status: Accepted

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

min_num = 10000000
ret = 0

for i in range(n):
    if p_list[i] < min_num:
        min_num = p_list[i]
        ret = ret + 1

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())

#a, b, c = (int(i) for i in input().split())  
P = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

minnum = P[0]
count = 1
for i in range(1, N):
    if minnum >= P[i]:
        count+=1
        minnum = P[i]
    else:
        pass

print(count)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    ps= LI()
    mins = []
    min_ = 10000000
    for i, v in enumerate(ps):
        if min_ > v:
            mins.append(v)
            min_ = v
        else:
            mins.append(min_)
    count = 0
    for i in range(n):
        if mins[i] >= ps[i]:
            count += 1
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import collections
#sys.setrecursionlimit(100000)

n=int(input())
tmp = input().split()
p = list(map(lambda a: int(a), tmp))


min = p[0]
ans = 0
#print(min)

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

Submission status: Accepted

Solution code:
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]


n = ni()
p = na()

c = 1
f = p[0]

for pi in p[1:]:
    if f >= pi:
        c += 1
        f = pi
print(c)

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

min_val = float("inf")

count = 0

for p in P:
    if p < min_val:
        count += 1
        min_val = p
print(count)

Submission status: Accepted

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

M = [P[0]]
tmp_min = P[0]
for i in range(1, N):
    if P[i] < tmp_min:
        tmp_min = P[i]
    M.append(tmp_min)

ans = 0
for i in range(N):
    if P[i] <= M[i]:
        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]:
        ans += 1
        Min = P[i]

print(ans)

Submission status: Accepted

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

ans = 0

mini = float('inf')

for p in P:
    mini = min(mini, p)
    if mini >= p:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
P = [int(x) for x in input().split()]
mins = [P[0]]
for i in range(1,n):
    mins.append(min(mins[-1], P[i]))

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

Submission status: Accepted

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

ans = 1

pa = p[0]

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
#import numpy as np

mod=int(10**9+7)

#main
N=int(input())
P=list(map(int,input().split()))
min_=mod
ans=0
for a in P:
    if min_>=a:
        min_=a
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0): # 四捨五入
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def round_up(a): # 切り上げ
    return int(a + 0.9)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    n = int(input())
    p = [x for x in map(int,input().split())]
    num = int(1e9)
    ans = 0
    for i in range(n):
        if p[i] <= num:
            num = p[i]
            ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


i = 0
min_val = float("inf")
res = 0
while i < N:
    if A[i] <= min_val:
        res += 1
    min_val = min(min_val, A[i])
    i += 1

print(res)

Submission status: Accepted

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

mn=10**9
count=0
for i,num in enumerate(ls):
    if num<=mn:
        count+=1
        mn=num
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
n = input()    
m = n.split()
p = [int(i) for i in m]
z = N + 1
a = 0
for i in p:
    if i < z:
        a = a + 1
        z = i
    else:
        pass
print(a)

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
ppp = get_nums_l()

ans = 0
min_ = 999999999999
max_ = -99999999999
for i,p in enumerate(ppp):

    if p < min_:
        min_ = p
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p_lis = list(map(int, input().split()))
min_p = n + 1
cnt = 0
for idx, p in enumerate(p_lis):
#     i = idx + 1
    if min_p > p:
        cnt += 1
    min_p = min(min_p, p)
print(cnt)

Submission status: Accepted

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

ans=0
mi=10**9
for i in range(N):
    if mi>P[i]:
        mi=P[i]
        ans+=1
        

print(ans)

Submission status: Accepted

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


def main():
    N = int(input())
    Ps = list(map(int, input().split()))

    lowest = Ps[0]
    total = 0

    for p in Ps:
        if p <= lowest:
            total += 1
            lowest = p

    print(total)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 0
cur = None
for i in range(N):
    if cur is None or cur >= P[i]:
        ans += 1
        cur = P[i]

print(ans)

Submission status: Accepted

Solution code:
def main():
    _=int(input())
    p=list(map(int,input().split()))
    x=10**9
    ans=0
    for i in p:
        if i <= x:
            ans += 1
            x=i
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
from collections import deque

n=int(input())
ans=0
m=99999999
s=input().split(" ")
for i in range(n):
    x=int(s[i])
    if x<m:
        ans+=1
    m=min(m,x)
print(ans)

Submission status: Accepted

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