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:
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

print(cnt)

Submission status: Accepted

Solution code:
import sys
# import math
# import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

# sys.setrecursionlimit(10000)

#### input
input = sys.stdin.readline
N = int(input())
# a, b = map(int, input().split())
Ps = list(map(int, input().split()))

mind = [None for _ in range(N)]
mind[0] = Ps[0]

for i in range(1, N):
  mind[i] = min(mind[i-1], Ps[i])


count = 0
for i in range(0, N):
  if mind[i] >= Ps[i]:
    count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

curmin = 10000000000
ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
cnt = 0

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

max = 100000000000

for i in range(N):
  if max > list[i]:
    cnt += 1
    max = list[i]

print(cnt)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
M = list(map(int, input().split()))
_min = np.inf
ans = 0

for i in range(N):
    if _min > M[i]:
        ans += 1
    _min = min(_min, M[i])

print(ans)

Submission status: Accepted

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

minv = arr[0]
cnt = 0
for v in arr:
    if v <= minv:
        cnt += 1
        minv = v

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
l = [int(x) for x in input().split()]
t_min = N + 1
ans = 0
for i in range(N):
  if l[i] < t_min:
    ans += 1
    t_min = l[i]
  elif t_min == 1:
    break
print(ans)

Submission status: Accepted

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

m=a[0]
count=0
for i in range(n):
  if m >= a[i]:
    m = a[i]
    count += 1

print(count)

Submission status: Accepted

Solution code:
n, a = input(), map(int, raw_input().split())
mi = n + 1
ans = 0
for i, x in enumerate(a):
    if mi > x:
        ans += 1
    mi = min(mi, x)
print ans

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

cur_min = P[0]
cnt = 1

for p in P[1:]:
    cur_min = min(cur_min, p)

    if p <= cur_min:
        cnt += 1

print(cnt)

Submission status: Accepted

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

res = 0
min_sofar = P[0]
for p in P:
    if p <= min_sofar:
        res += 1
    if p < min_sofar:
        min_sofar = p

print(res)

Submission status: Accepted

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

min_num = 2 * 10**5 + 1

count = 0

for i in range(N):
  if(P_list[i] <= min_num):
    count += 1
    min_num = P_list[i]

print(count)

Submission status: Accepted

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

ans = 0
now = P[0]

for p in P:
    if now >= p:
        ans += 1
        now = p

# print('-----output-----')
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

count=0
min_number=P[0]

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MAX = 2 * (10**5) + 1


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

    min_i = []
    current_min = MAX
    for p in ps:
        if p < current_min:
            current_min = p

        min_i.append(current_min)

    ans = 0
    for tmp_min, p in zip(min_i, ps):
        if tmp_min >= p:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

count = 1  # i = 1 は OK
acc_min = P[0]
for i in range(1, N):
    if acc_min >= P[i]:
        count += 1
    acc_min = min(acc_min, P[i])
print(count)

Submission status: Accepted

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

m=P[0]
count=0
for p in P:
    if m >= p:
        count+=1

    m=min(m,p)

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

min_ = px[0]
cnt = 1
for i in range(1, len(px)):
    min_ = min(px[i-1], min_)
    #print(i, min_)
    if min_ > px[i]:
        cnt += 1
print(cnt)

Submission status: Accepted

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

    ans = 0
    current_min = 2 * 10 ** 5 + 1

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from pprint import pprint

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

    print(ans)

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    p = list(map(int,sys.stdin.readline().strip().split(" ")))
    
    solve(n, p)

Submission status: Accepted

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

min_num = float("inf")
result = 0
for P in Ps:
    if P < min_num:
        result += 1
        min_num = P

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

  print(ans)

if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
p_min = [10 ** 18 for _ in range(n)]

p_min = p[0]
count = 1
for i, p_i in enumerate(p):
    if 0 == i:
        continue
    p_min = min(p_i, p_min)
    if p_i == p_min:
        count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
MAX = float('inf')

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

min_a = [MAX]*n
min_a[0] = pp[0]

for i in range(1,n):
  min_a[i] = min(min_a[i-1],pp[i])
  
ans = 0
for i in range(n):
  if min_a[i]>= pp[i]:
    ans += 1

print(ans)

Submission status: Accepted

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

x = p[0]
ans = 0
for i in p:
    if x >= i:
        ans += 1
        x = i

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
a = 200000
b = 0
for i in range(N):
    if a >= P[i]:
        a = P[i]
        b = b + 1
print(b)

Submission status: Accepted

Solution code:
#coding:utf-8

n = int(input())
nums = map(int, input().split(' '))

minv = 10000000000000
cnt = 0
for num in nums:
    if minv > num:
        cnt += 1
        minv = num
print(cnt)

Submission status: Accepted

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

INF = 2 * 10 ** 5 + 1
ans = 0
min_p = INF
for i in range(n):
    if ps[i] <= min_p:
        ans += 1
        min_p = ps[i]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import numpy as np


DEBUG = True
dprint = print if DEBUG else lambda *x : x

N = int(input().strip())
P = [int(str) for str in input().strip().split()]

minnum = P[0]
ans = 0
for i in P:
    if i <= minnum:
        minnum = i
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
lst = list(map(int, input().split()))
min_num = lst[0]
cnt = 0
for x in lst:
    if x <= min_num:
        cnt += 1
        min_num = x

print(cnt)

Submission status: Accepted

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

cnt = 0
R = []
for i in range(N):
    if i == 0:
        cnt += 1
        last = P[i]
    else:
        if last > P[i]:
            cnt += 1
            last = P[i]

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
p = np.array(list(map(int, input().split())))
ans = 1
min_n = p[0]
for i in range(1, n):
    min_n = min(min_n, p[i-1])
    if p[i] <= min_n:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

m = p[0]
n = 0
for _p in p:
    if m >= _p:
        n += 1
        m = _p

print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
li_a = []
li_a.append(li[0])
for i in range(1, n):
  if li[i] < li_a[-1]:
    li_a.append(li[i])
print(len(li_a))

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    _ = int(stdin.readline().rstrip())
    Pn = [int(x) for x in stdin.readline().rstrip().split()]
    min_ = 200001
    count = 0
    for x in Pn:
        if x <= min_:
            min_ = x
            count += 1
    print(count)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

ans = 1
m = p[0]
p = p[1:]
for e in p:
  if e < m:
    ans += 1
  m = min(m, e)

print(ans)

Submission status: Accepted

Solution code:
import math,sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili=lambda:list(map(int,sys.stdin.readlines()))
li = lambda:list(map(int,input().split()))
#for deque append(),pop(),appendleft(),popleft(),count()
I=lambda:int(input())
S=lambda:input().strip()
mod = 1000000007

n=I()
a=li()
m=1000000
c=0
for i in range(n):
    if(a[i]<m):
        c+=1
        m=a[i]
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
P = [int(x) for x in stdin.readline().rstrip().split()]
mi = P[0]
ma = P[0]
ans = 0
for i in range(N):
    if P[i] <= mi:
        ans += 1
    ma = max(ma,P[i])
    mi = min(mi,P[i])
print(ans)

Submission status: Accepted

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

amin = N
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 200000
count = 0

for i in range(n):

    if p[i] <= ans:
        count += 1
        ans = p[i]

print(count)

Submission status: Accepted

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

count = 0
num = n+1
for i in range(n):
  if num > arr[i]:
    count += 1
  num = min(num,arr[i])
  if num == 1:
    break

print(count)

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
 

N=int(input())
p=list(map(int,input().split()))
cnt=0

m=10**6
for k in range(N):
	m=min(m,p[k])
	if m==p[k]:
		cnt+=1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

minval = float("inf")
result = 0
for p in ps:
    if p <= minval:
        result += 1
    minval = min(minval, p)
print(result)

Submission status: Accepted

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

mn = ls[0]
cnt = 1

for i in range(1, n):
    if mn != min(mn, ls[i]):
        cnt += 1
        mn = ls[i]

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0

prev_min = p[0]

for i in p:
    if prev_min >= i:
        ans += 1
        prev_min = i


print(ans)

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    P = list(iim())
    m = P[0]
    i = 0
    for pi in P:
        if pi > m:
            continue
        m = pi
        i += 1
    print(i)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0
m = 10**9
for i in range(n):
  if m > p[i]:
    ans += 1
    m = p[i]
  else:
    continue
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p_list = list(map(int, input().split()))
min_num = p_list[0]
ans = 1

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

print(ans)

Submission status: Accepted

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

cnt = 0
current = None

for i in p:
    if current is None or current >= i:
        cnt += 1
        current = i

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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


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


    print(ans)



    
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N= int(input())
x = list(map(int, input().split()))
min=100000000
count=0

for i in range(N):
    if x[i]<=min:
        count=count+1
        min=x[i]
print(count)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())

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

m=2*10**5+1

ans=0

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
P = list(map(int, input().split()))
L = [P[0]]
ans = 0
for i in range(1, N):
    if L[-1] == P[i]:
        ans += 1
    L.append(min(L[-1], P[i]))
print(len(set(L)) + ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
itr = map(int, input().split())
mn = int(next(itr))
ans = 1

for p in itr:
    if p <= mn:
        ans += 1
        mn = p

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
minnum=A[0]
sol=[]
for i in range(N):
   if A[i]<=minnum:
      sol.append(A[i])
      minnum=A[i]
print(len(sol))

Submission status: Accepted

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

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

Submission status: Accepted

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

min = P[0]

ans = 0

for i in range(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()))

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
mi = Pn[0]
for i in range(1, N):
    mi = min(mi, Pn[i])
    if Pn[i] == mi:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
vmin = A[0]
ans = 1

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

print(ans)

Submission status: Accepted

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

max_lst = [2 * 10 ** 6 for i in range(N + 1)]
ctr = 0

for i in range(1, N + 1):
	max_lst[i] = min(max_lst[i - 1], P[i - 1])

for i in range(N):
	if max_lst[i] >= P[i]:
		ctr += 1
print(ctr)

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

min_n = float('inf')
counter = 0

for i in range(n):
  if P[i] <= min_n:
    counter += 1
    min_n = P[i]
    
print(counter)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N= int(input())
li_P = list(map(int, input().split()))
min = li_P[0]
count = 0
for p in li_P:
    if p <= min:
        count += 1
        min = p
print(count)

Submission status: Accepted

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

count=0
min=p[0]
for i in p:
    if i>min:
        pass
    else:
        min=i
        count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N  = int(input())
P = list(map(int, input().split()))
MIN = 2*(10**5)
ans = 0

for p in P:
    if MIN >= p:
        ans += 1
        MIN = p

print(ans)

Submission status: Accepted

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

min_val = 200001
sum = 0
for i in range(n):
	if p[i] <= min_val:
		sum += 1
		min_val = p[i]

print(sum)

Submission status: Accepted

Solution code:
import sys


def solve(inp):
    N = int(inp.readline().strip())
    P = list(map(int, inp.readline().strip().split(' ')))

    r = 0
    minp = P[0]
    for p in P:
        if minp >= p:
            r += 1
            minp = p

    return str(r)


def main():
    result = solve(sys.stdin)
    if result:
        print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
P = np.array(input().split(), dtype=int)
Q = P.copy()

for i in range(1,N):
  Q[i] = min(Q[i-1], Q[i])

print(np.sum(P==Q))

Submission status: Accepted

Solution code:
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


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


# A
def A():
    n, m = LI()
    if n == m:
        print("Yes")
    else:
        print("No")

    return


# B
def B():
    a, b = LI()
    if a <= b:
        ans = str(a) * b
    else:
        ans = str(b) * a
    print(ans)
    return


# C
def C():
    n = I()
    p = LI()
    n_min = n + 1
    ans = 0
    for num in p:
        if num < n_min:
            ans += 1
            n_min = num
    print(ans)
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


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

Submission status: Accepted

Solution code:
from collections import defaultdict

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

m = float('inf')
ret = 0
for i, p in enumerate(P) :
  if p < m  :
    ret += 1
    m = p
    
print(ret)

Submission status: Accepted

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

cnt = 1
min = P[0]

for i in range(1, len(P)):
    if P[i] < min:
        cnt += 1
        min = P[i]

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
m = 1e10
ans = 0
for i in range(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()))

rui = [None] * (N)
rui[0] = P[0]
# print(rui)

for i in range(1, N):
    a = rui[i-1]
    b = P[i]
    rui[i] = min(a, b)


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

Submission status: Accepted

Solution code:
N = int(input())
import numpy as np
P = np.array(list(map(int,input().split())))
ans = 1
min_p = P[0]
for p in P[1::]:
  if min_p>=p:
    ans+=1
  min_p=min(p,min_p)
    
print(ans)

Submission status: Accepted

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

min_num = 1000000000
count = 0
for p in p_list:
  if min_num >= p:
    count += 1
    min_num = p
print(count)

Submission status: Accepted

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

    min_ = 2 * 10**6
    ans = 0
    for i in range(N):
        if p[i] < min_:
            min_ = p[i]
            ans += 1

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
min=p[0]
ans=1
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())
a = list(map(int, input().split()))

mn = 10 ** 10
cnt = 0
for i in a:
    mn = min(mn, i)
    if mn >= i:
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

min_val = P[0]
cnt = 1
for i in range(1, len(P)):
    if P[i] <= min_val:
        min_val = P[i]
        cnt += 1
print(cnt)

Submission status: Accepted

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

    ans = 0
    min_p = 999999999999
    for P in PN:
        if P <= min_p:
            min_p = P
            ans += 1

    print(ans)


main()

Submission status: Accepted

Solution code:



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

idxs = [0] * (N+1)
for i in range(N):
    idxs[P[i]] = i

ans = 0
last = N+10
for i in range(1,N+1):
    if idxs[i] < last:
        ans += 1
        last = idxs[i]
    else:
        continue

print(ans)

Submission status: Accepted

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

m = 2 * (10**5) + 1
c = 0
for i in p:
    if m > i:
        c += 1
    m = min(m, i)
print(c)

Submission status: Accepted

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

ans = 0
max_num = INF
for i in P:
    if i<=max_num:
        ans += 1
        max_num = i
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
m_list = [0]*N
m_list[0] = P[0]
res = 1

for i in range(1, N):
  m_list[i] = min(m_list[i-1], P[i])
  if m_list[i] == P[i]:
    res += 1
  
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#300
N = int(input())
L = list(map(int,input().split()))
mini = L[0]
n = 1
if N > 1:
    for i in range(N-1):
        if mini > L[i+1]:
            n = n+1
            mini = L[i+1]
print(n)