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

P = [0] + P
     
count = 0
min = 10000000000000
for i in range(1, N+1):
    if min > P[i]:
        min = P[i]
    elif min < P[i]:
        continue
    """
    for j in range(1, i+1):
        #print(i, P[i], j , P[j])
        if P[i] > P[j]:
            #print("out", i)
            break
    else:
        #print("ok", i)
        count += 1
    """
    count += 1
        
    if P[i] == 1:
        break

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
import sys
n = int(input())
P = list(map(int, input().split()))

minvalue = sys.maxsize

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

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 1

m = s[0]

for i in range(1,len(s)):
    if s[i] == 1:
        ans += 1
        break
    elif s[i]>m:
        continue
    else:
        m = s[i]
        ans += 1
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

now_min = 999999 # Large number. 2*10**5より小さくしないように注意。
ans = 0

for p in P:
    if now_min > p:
        now_min = p
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
# = map(int, input().split())
P = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

count = 0
minimum = 300000

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

print(count)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
import itertools

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

a = list(itertools.accumulate(P, func=min))
ans = 0
for i in range(N):
    if P[i] <= a[i]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
A=10**100
ans=0
for i in P:
    A=min(A,i)
    if A==i:
        ans+=1
print(ans)

Submission status: Accepted

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

m = 10**9
ans=0
for a_i in a:
  m = min(a_i,m)
  if m==a_i:
    ans+=1
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(n):
    if p[i]<=min:
        count+=1
        min=p[i]
print(count)

Submission status: Accepted

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

ans = 0
m = P[0]

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

print(ans)

Submission status: Accepted

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

m = float('inf')
ans = 0
n_min = 0
for i in range(0,n):
  if m >= p[i]:
    ans += 1
    m = p[i]
print(ans)

Submission status: Accepted

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

ans = 0
min_num = P_list[0]

for p in P_list:
    if p <= min_num:
        ans += 1
        min_num = p

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
INF=float('inf')

def main():
    N=int(input())
    P=[int(_) for _ in input().split()]
    tmp=INF
    ans = 0

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

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

Submission status: Accepted

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

cnt = 1
lmin = lp[0]
for i in range(1, N):
    if lp[i] < lmin:
        lmin = lp[i]
        cnt += 1
    elif lp[i] == 1:
        break

print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat May  9 01:35:28 2020

@author: shinba
"""
n = int(input())
p = list(map(int,input().split()))

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:
n = int(input())
p = list(map(int, input().split()))
m =[0] * n
m[0] = p[0]
mi = m[0]
for i in range(1, n):
    mi = min(mi, p[i])
    m[i] = mi
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()))
P_max = []
P_min = []

for i in range(N):
  if not P_max:
    P_max.append(P[0])
    P_min.append(P[0])
  else:
    P_max.append(max(P_max[-1], P[i]))
    P_min.append(min(P_min[-1], P[i]))
    
ans = 0
for i in range(N):
  if P[i] <= P_max[i] and P[i] <= P_min[i]:
    ans += 1
    
print(ans)

Submission status: Accepted

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

cnt = 0
min_p = float("inf")
for p in P:
    if p <= min_p:
        min_p = p
        cnt+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

temp = 11111111111111111
cnt = 0
for i in p:
    temp = min(temp,i)
    if temp >= i:
        cnt += 1
print(cnt)

Submission status: Accepted

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

gomi=max(plist)
output=0

for p in plist:
    if p == plist[0]:
        gomi=p
        output+=1
    else:
        if p <= gomi:
            gomi=p
            output+=1

print(output)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

maxes = []
mins  = []

max = 0
min = 0
result = 0

for i in range(N):
    if i == 0:
        max = P[i]
        min = P[i]
    else:
        if(max < P[i]):
            max = P[i]
        if(min > P[i]):
            min = P[i]

    maxes.append(max)
    mins.append(min)

for i in range(N):
    if mins[i] == P[i]:
        result = result + 1

print(result)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#ABC 152 C - Low Elements

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

count = 0

tmp_min = Ps[0]
for i in range(N):
    
    if(tmp_min >= Ps[i]):
        count += 1
        tmp_min = Ps[i]
    else:
        pass
    
    
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

for n in range(1,N):
  if P[n]<=P2[-1]: 
    P2.append(P[n])
  
print(len(P2))

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int,input().split()))
cnt=0
min_num = 10**9

for i in li:
    if min_num >= i:
        cnt+=1
        min_num = i
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

min_value=Nums[0]

cnt=0

for i in range(N):
    min_value = min(min_value,Nums[i])
    
    if Nums[i]<=min_value:
        cnt+=1
    
    

print(cnt)

Submission status: Accepted

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

count = 0
tmpmin = P[0]
for p in P:
  if p <= tmpmin:
    count += 1
    tmpmin = p

print(count)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
P = np.array(list(map(int, input().split())))
T = np.zeros(n)
T[0] = P[0]
for i in np.arange(1,n,1):
    T[i] = min(T[i-1], P[i])
print(np.sum(P==T))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n = I()
P = LI()
ans = 0
tmp = INF
for i in range(n):
    if P[i] < tmp:
        ans += 1
        tmp = P[i]
print(ans)

Submission status: Accepted

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

cnt = 0
tmp = p[0]

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

Submission status: Accepted

Solution code:
# C - Low Elements

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

mn = float('inf')
cnt = 0
for i in range(N):
    mn = min(mn, P[i])
    if P[i] <= mn:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

'''
参考
https://cocoinit23.com/abc152/
すべての(i, j)を調べていると制限時間を超過してしまう。
listの2つ目の要素(index=1)から順に見ていって、最小値が更新されたら解をカウントアップする。
ただし、解の最小値は常に1となるので、解の初期値は1にしておくこと。
'''
ans = 1
min_p = P[0]

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

Submission status: Accepted

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

ans = 1
mini = p[0]

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

Submission status: Accepted

Solution code:
from sys import stdin


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

N = int(input().strip())
P_list = list(map(int, input().rstrip().split()))
#-----
min_P = float("inf")
cnt = 0

for p in P_list:
    if min_P >= p:
        cnt += 1
        min_P = min(min_P, p)

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
P =list( map(int, input().split()))
s = P[0]
t = min(P)
Pmin = [P[0]]
for i in range(N - 1):
  if P[i + 1] < Pmin[i]:
    Pmin.append(P[i + 1])
  else:
    Pmin.append(Pmin[i])

cnt = 0

for j in range(N):
  if P[j] == Pmin[j]:
    cnt += 1
  else:
    pass
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
m = float('inf')
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

count = 0
mini = n + 1
for p in map(int, input().split()):
    if mini >= p:
        count += 1
        mini = p

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,*p=map(int,open(0).read().split())
m=p[0]
ans=0
for p_i in p:
  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()))

cnt = 0
pre_m = P[0]
for i in range(1, N+1) :
   
    m = min(P[i-1:i])
    if pre_m > m :
        pre_m = m
    else :
        m = pre_m

    if P[i-1] == m :
        cnt = cnt + 1

print(cnt)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P_list = list(map(int,input().split()))
M = P_list[0]
cnt = 1

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

print(cnt)

Submission status: Accepted

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

def main():
    N = int(input())
    *P, = map(int, input().split())

    mini = 10**6
    cnt = 0
    for _ in P:
        if _ < mini:
            mini = _
            cnt += 1
        else:
            continue
    print(cnt)


main()

Submission status: Accepted

Solution code:
N=int(input())
P=[int(i) for i in input().split()]
min=2*(10**5)+1
cnt=0
for r in P:
    if min>=r:
        min=r
        cnt+=1
    else:
        continue
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = list(map(int, input().split(' ')))
    min_pj = N
    answer = 0
    for i in range(N):
        min_pj = min([min_pj, P[i]])
        if min_pj == P[i]:
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
mnum = N + 1
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
N = int(input())
P = list(map(int,input().split()))
cnt = 0
mi = P[0]
for i in range(N):
    if P[i]<=mi:
        cnt +=1
    mi = min(mi,P[i])
print(cnt)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0

#i=0
min0 = p[0]
count+=1

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

print(count)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
ans=0;
mini = n+1
for i in range(n):
  if a[i]<mini:
    mini=a[i]
    ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    cnt=0
    min=l[0]
    for i in l:
        if i<=min:
            cnt+=1
            min=i
    print(cnt)
resolve()

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    P = list(map(int, input().split()))
    now = N + 1
    cnt = 0
    for p in P:
        if now > p:
            cnt += 1
            now = p
    return cnt

print(solve())

Submission status: Accepted

Solution code:
n = int(input())
li =list(map(int,input().split()))
m =li[0]
ans = 0
for x in li:
  if x<= m:
    ans+=1
    m = x
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, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
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:
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, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
P = LIST()

cnt = 1
MIN = P[0]

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

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
P = list(map(int, input().split()))
P.append(0)
P = np.array(P)
ans = 1
tmp = P[0]
for i in range(1,N):
  if P[i] < tmp:
    ans += 1
    tmp = P[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()
A = li()

min_a = float('inf')
#max_a = -1
cnt = 0
for num in A:
    if num < min_a:
        cnt += 1
        min_a = num
print(cnt)

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 i <= P_min:
        ans += 1
        P_min = i        
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    count = 1
    num = P[0]
    for i in range(1, N):
        if num >= P[i]:
            count += 1
            num = P[i]
    print(count)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

min_list = [0 for i in range(N)]
min_list[0] = P[0]
for i, p in enumerate(P):
    if i == 0:
        continue
    if p < min_list[i-1]:
        min_list[i] = p
    else:
        min_list[i] = min_list[i-1]

ans = 0
for i, p  in enumerate(P):
    if p <= min_list[i]:
        ans += 1
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
pn = list(map(int, input().split()))
count = 1
min = pn[0]

for i in range(1,len(pn)):
    if min > pn[i - 1]: min = pn[i - 1]
    if min > pn[i]: count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

counter = 0
min = P[0]
for i in P:
    if min >= i:
        counter += 1
        min = i
print(counter)

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
 
result = 0
mini = [P[0]]
 
for i in range(N-1):
    if mini[i]>P[i+1]:
        mini.append(P[i+1])
    else:
        mini.append(mini[i])
 
for i in range(N):
    if P[i]==mini[i]:
        result += 1
 
print(result)

Submission status: Accepted

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

mi=2*10**5+1
cnt=0
for i in P:
  
  if i<=mi:
    cnt+=1
  mi=min(mi,i)
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
p_list = list(map(int, input().split()))
i_sum = 0
p_min = p_list[0]

for i in range(n):
    if p_min >= p_list[i]:
        i_sum += 1
        p_min = p_list[i]
    else:
        continue
print(i_sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
p = np.array(input().split(),dtype=int)

minp = n+1
ans = 0
for i in p:
    if i < minp:
        minp = i
        ans += 1

print(ans)