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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

N = int(input())
a = list(map(int,input().split()))
mi = 10**9
res = 0
for i in range(N):
    if a[i] < mi:
        res += 1
        mi = a[i]
print(res)

Submission status: Accepted

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

ans = 0
min_pi = p[0]
for pi in p:
  if pi <= min_pi:
    ans += 1
    min_pi = pi

print(ans)

Submission status: Accepted

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

M = float('inf')
ans = 0
for p in P:
    if M > p:
        ans += 1
    M = min(M, p)

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))

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

Submission status: Accepted

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

m = p[0]

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print (ans)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = input()
    pp = map(int, raw_input().split())
    c = 1
    m = pp[0]
    for p in pp[1:]:
        if m >= p:
            c += 1
            m = p
    print c


main()

Submission status: Accepted

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

Submission status: Accepted

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

local_min = 10 ** 7
count = 0
for p in ps:
    if p <= local_min:
        count += 1
        local_min = p

print(count)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    mn=10**10
    n=II()
    aa=LI()
    ans=0
    for a in aa:
        if a<mn:ans+=1
        mn=min(a,mn)
    print(ans)
main()

Submission status: Accepted

Solution code:
def main():
    inf = float('inf')

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

    ma = inf
    ret = 0
    for x in p:
        if x <= ma:
            ret += 1
            ma = x
    print(ret)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    lp = rli()
    m = n+1
    ans = 0
    for p in lp:
        if p <= m:
            ans += 1
        m = min(m, p)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

N = int(input())
p = list(map(int, input().split()))
M = 10**18
ans = 0

for pi in p:
    if pi<=M:
        ans += 1
        M = pi

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,m = [int(i) for i in readline().split()]
#d = [int(i) for i in readline().split()]


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

m = n+10
ans = 0
for i,ai in enumerate(a):
    m = min(m,ai)
    if m==ai:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int, input().split()))
m = float("inf")
ans = 0
for i in P:
  if m > i:
    m = i
    ans += 1
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 P[i]<=m:
        ans+=1
        m = P[i]
print(ans)

Submission status: Accepted

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

class Binary_Indexed_Tree():
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)

    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += i & -i

    def sum(self, i):
        ret = 0
        while i:
            ret += self.data[i]
            i &= i-1
        return ret

ans= 0
BIT = Binary_Indexed_Tree(n+1)
for i in range(n):
    BIT.add(p[i], 1)
    if BIT.sum(p[i]-1) == 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n = inp()
    p = inpl()
    ans = 0
    m = 10**6
    for i in range(n):
        if m > p[i]:
            m = p[i]
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
P = III()

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
m = 10**6

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

print(ans)

Submission status: Accepted

Solution code:
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

def main():
    n = ii()
    p = li()
    m = p[0]
    cnt = 0
    for i in p:
        m = min(i,m)
        if m == i:
            cnt+=1

    print(cnt)
        



main()

Submission status: Accepted

Solution code:
N = int(input())
A = [int(n) for n in input().split()]
minimum = 10**7
res = 0
for a in A:
    if a < minimum:
        res += 1
        minimum = a
print(res)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
p = LI()
tmp = inf
ans = 0
for i in range(n):
    if tmp > p[i]:
        ans += 1
        tmp = p[i]
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
P=[int(i) for i in input().split()]
c=0
min_=P[0]
for i in range(N):
    if P[i]>min_:
        pass
    else:
        c+=1
        min_=P[i]
print(c)

Submission status: Accepted

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

    m = 10**6
    cnt = 0
    for i in range(n):
        if p[i] < m:
            cnt += 1
        m = min(m, p[i])
    print(cnt)


main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, P: "List[int]"):

    count = 0
    m = INF
    for p in P:
        if m > p:
            count += 1
            m = p
    print(count)

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

minP = N+1
ans = 0
for P in Ps:
    if P <= minP:
        ans += 1
        minP = P

print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n = ri()
ls = ril()
res = 0
minval = float('inf')
for x in ls:
    if x < minval:
        res += 1
        minval = x
print(res)

Submission status: Accepted

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

ans = 0
now_min = A[0]

for a in A:
  if now_min >= a:
    ans += 1
  now_min = min(now_min, a)
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

INF = 1<<30
ans = 0
minv = INF
for p in P:
    if p<=minv:
        minv = p
        ans += 1
print(ans)

Submission status: Accepted

Solution code:

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

cnt = 0
m = N+1
for p in P:
    if m >= p:
        m = p
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
res = 0
for i in range(n):
    if i == 0:
        res += 1
        m = a[i]
        continue
    if m > a[i]:
        res += 1
        m = a[i]
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
minP = 2 * (10 ** 5)
for i in listP:
  if i <= minP:
    cnt += 1
    minP = i

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


temp_min = arr[0]
ans = 0
for i in range(n):
    if arr[i] <= temp_min:
        temp_min = arr[i]
        ans += 1
    else:
        continue

print(ans)

Submission status: Accepted

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

MIN=1<<30
ANS=0

for p in P:
    MIN=min(p,MIN)
    if p<=MIN:
        ANS+=1
print(ANS)

Submission status: Accepted

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

tmp = 10**9

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

print(ans)

Submission status: Accepted

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

from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
P = map(int, raw_input().split())
cur = N + 1
ans = 0
for num in P:
    if num < cur:
        ans += 1
        cur = num
print ans

Submission status: Accepted

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


ans = 0
now = float('inf')
for i in range(N):
    if now > P[i]:
        now = P[i]
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
mi = N + 1
ans = 0
for p in [int(a) for a in input().split()]:
    if p < mi:
        ans += 1
        mi = p
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
p=[int(j) for j in input().split()]
t=10**18
ans=0
for i in p:
    if i<=t:
        ans+=1
        t=i
print(ans)

Submission status: Accepted

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

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

minimum=10**10
retval=0
for p in P:
    if p<minimum:
        minimum=p
        retval+=1

print(retval)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

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

Q = np.minimum.accumulate(P)

answer = np.count_nonzero(P <= Q)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

mn = 10**6
ans = 0
for p in P:
  if p < mn:
    ans += 1
    mn = p
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

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()

tmp = P[0]
ans = 1
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()))
mini = 1999999
ans = 0
for i in range(n):
    if mini > p[i]:
        ans += 1
        mini = p[i]
print(ans)

Submission status: Accepted

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

ans = 0
m = float("inf")
for i in p:
    if i <= m:
        ans += 1
    m = min(m, i)

print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import deque
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from bisect import bisect, bisect_left

def solve():
    input = sys.stdin.readline
    N = int(input())
    P = [int(p) for p in input().split()]
    minN = P[0]
    count = 1
    for p in P[1:]:
        if minN > p:
            count += 1
            minN = p

    print(count)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    now = inf
    ans = 0
    for a in A:
        if a<=now:
            ans+=1
            now = a
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

m = 10 ** 6
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())
P = list(map(int,input().split()))

m = 10**6
ans = 0
for p in P:
    if p < m:
        m = p
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    p = LI()
    ans = 1
    min = p[0]
    for i in p[1:]:
        if i < min:
            ans += 1
            min = i
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
mn = 10 ** 100
res = 0
for i in a:
    if i <= mn:
        res += 1
    mn = min(mn, i)
print(res)

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

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

P = np.array(P, dtype=int)
ans = (P == np.minimum.accumulate(P)).sum()
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


N = inp()
PP = inpl()

m = INF
ans = 0
for p in PP:
    if m > p:
        ans += 1
    m = min(m,p)

print(ans)

Submission status: Runtime Error

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

min = p[1]
count = 1

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

print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int,input().split()))
count = 1
if n >=2:
  for i in range(n-2):
    a = min(x(range(0,i,1)))
    if a >=x[i+1]:
      count+=1
    else:
      count+=0
else:
  print(count)
  exit()
  
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int,input().split()))
count = 1
if n >=2:
  for i in range(n-2):
    a = min(x(range(0,i)))
    if a >=x[i+1]:
      count+=1
    else:
      count+=0
else:
  print(count)
  exit()
  
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(1, n):
    new = p[:i]
    m = max(new)
    print(new)
    if p[i] < m:
        count += 1

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

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

num = P[0]
count = 1

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

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

cnt=1

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

Submission status: Runtime Error

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

i=0
while 1:
    j=i+1
    while 1:
        if P[i]<P[j] :
            P.remove(P[j])
        if j>=len(P)-1:
            break
        j+=1
    if i>=len(P)-2:
        break
    i+=1

print(len(P))