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())
n_list = list(map(int, input().split()))
min_num = n
count = 0
for i in range(n):
    if min_num >= n_list[i]:
        min_num = n_list[i]
        count += 1
print(count)

Submission status: Accepted

Solution code:
#-*- coding: utf-8
#  -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""
from collections import defaultdict
import sys
import math
from datetime import datetime

def sol(S):
    if len(S) == 1: return 1
    maxi = S[0]
    mini = S[0]
    counter = 0
    for i, n in enumerate(S):
        if maxi >= n and mini >= n:
            counter += 1
        maxi = max(maxi, n)
        mini = min(mini, n)
    #print(maxi, mini)
    return counter



do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    k = int(parsed_lines[0][1])
    S = parsed_lines[1][0]
    return n, k, S


if not do_submit:
    a, b, c = input_parse("""
    3 1
    ABC
    """)
    print(sol(a, b, c))

    a, b, c = input_parse("""
    4 3
    CABA
    """)
    print(sol(a, b, c))

else:
    #a, b = list(map(int, input().split()))
    n = int(input().strip())
    S = list(map(int, input().split()))
    # a = int(input())
    # b = int(input())
    # T = input()
    print(sol(S))
    # S = input().strip()
    # print(sol(S))

Submission status: Accepted

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
min = 10**9
for i in P:
    check = 0
    if min > i:
        min = i
    if i <= min:
        count += 1

print(count)

Submission status: Accepted

Solution code:
n = input()
lst = list(map(int, input().split()))
#print(lst)

r = 0
j = lst[0]
for i in lst:
    if i <= j:
        r += 1
    if j > i:
        j = i
    
print(r)

Submission status: Accepted

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

min_list = [p[0]]
count = 1
for i in range(1,n) :
    if p[i] < min_list[i - 1] :
        min_list.append(p[i])
    else :
        min_list.append(min_list[i - 1])

for j in range(1,n) :
    if p[j] <= min_list[j - 1] :
        count += 1

print(count)

Submission status: Accepted

Solution code:
# coding: utf-8
from sys import stdin


def main():
    # コンソール入力を受け取る
    N = int(stdin.readline().rstrip())
    P = stdin.readline().rstrip().split()
    P = [int(i) for i in P]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 1
min_P = P[0]

for i in range(1, N):
    if P[i] >= min_P:
        continue
    else:
        min_P = P[i]
        ans += 1
print(ans)

Submission status: Accepted

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


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

    cnt = 1
    min_num = P[0]
    for p in P:
        if p < min_num:
            min_num = p
            cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

lst = []

for i in range(N):
    if lst == []:
        lst.append(P[i])
    elif lst[-1] > P[i]:
        lst.append(P[i])
    else:
        pass
print(len(lst))

Submission status: Accepted

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

cnt = 1
small = nums[0]
for i in range(n-1):
    if small >= nums[i + 1]:
        cnt += 1
        small = nums[i+1]
        
print(cnt)

Submission status: Accepted

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

ans = 0
min_v = 2 * (10 ** 6)

for v in p:
  if min_v == 1:
    break
  if min_v > v:
    ans += 1
    min_v = v
  else:
    continue
print(ans)

Submission status: Accepted

Solution code:
# import itertools
# import math


def solve(N, P):
    if P[0] == 1:
        return 1
    ans = [P[0]]

    for i in range(1, N):
        if ans[-1] > P[i]:
            ans.append(P[i])

    return len(ans)


N = int(input())
# S = input()
# A, B = map(int, input().split())
P = list(map(int, input().split()))

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(N, P))

Submission status: Accepted

Solution code:
def resolve():
    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__":
    resolve()

Submission status: Accepted

Solution code:
n = int(input())
p = [int(s) for s in input().split()]
count = 0
M = p[0]
for a in range(n):
     i = p[a]
     if M >=i :
          count+=1
          M = i
print(count)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
x = 0
l = []
for i in p:
    try:
        if l[0] > i:
            l[0] = i
            x += 1
    except:
        l.append(i)
print(x+1)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# C - Low Elements
import  sys

def solve152C(N, plist):
	
	count = 1
	maxnumber = plist[0]
	minnumber = plist[0]
	isFound = True
	for i in range(2, N+1):
		p = plist[i-1]
		if p < maxnumber and p < minnumber:
			count += 1
		
		if p > maxnumber:
			maxnumber = p
		if p < minnumber:
			minnumber = p
					
	print(count)


if __name__ == "__main__":
	
	N = int(input())
	plist= list(map(int, input().split()))

	solve152C(N, plist)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
num_list = [int(item) for item in input().split()]

cnt = 1
prev_num = num_list[0] 

for i in num_list[1:]:
    if i < prev_num:
        cnt += 1
        prev_num = i

print(cnt)

Submission status: Accepted

Solution code:
a = int(input())
s = list(map(int, input().split()))
min_val = 3 * 10 ** 5
count = 0
for i in s:
  if min_val >= i:
    count += 1
  min_val = min(min_val, i)
print(count)

Submission status: Accepted

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

cnt = 0
min_val = 2 * 10 ** 5 + 1

for p in pp:
    if min_val >= p:
        cnt += 1
        min_val = p

print(cnt)

Submission status: Accepted

Solution code:
# ABC 152 C
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
snm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
p=nl()
s=[]
ans=0
min_v=10**6
for i in range(n):
    if i==0:
        ans+=1
        s.append(p[i])
        min_v=min(min_v,p[i])
        continue
    if p[i]<=min_v:
        ans+=1
    s.append(p[i])
    min_v=min(min_v,p[i])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
seq = list(map(int,input().split()))
ans = 1
minim = n

for i in range(1, n):
    minim = min(minim, seq[i-1])
    if minim > seq[i]:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = map(int, input().split())
ans = 0
bef = n

for i in l:
  if i <= bef:
    ans += 1
    bef = i
  else:
    continue
    
print(ans)

Submission status: Accepted

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

times = 0
min_num = N+1
for i in range(len(P)):
  safe = True
  if min_num < int(P[i]):
    continue
  min_num = int(P[i])
  times += 1
print(times)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 1
minj = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

    ans = 1
    minnum = ps[0]
    for i in range(N):
        if minnum > ps[i]:
            minnum = ps[i]
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    N = I()
    P = LI()
    Min = N

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



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
l  = int(input())
order = list(input().split())
for i in range(l):
    order[i] = int(order[i])


min  = order[0]
a = 0

for i in range(l):
    if order[i] <= min:
        a = a + 1
        min  = order[i]
print(a)

Submission status: Accepted

Solution code:
N = int(input())

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

result = 0
min_tmp = N + 1
for x in range(N):
    if p_n[x] < min_tmp:
        result += 1
    min_tmp = min(min_tmp,p_n[x])

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#C - Low Elements
N = int(input())
A = list(map(int, input().split()))
count = 1
tmp = A[0]
for i in range(1,N):
    if A[i] <= tmp:
        count += 1
        tmp = A[i]
    else:
        pass
print(count)

Submission status: Accepted

Solution code:
N = int(input())
a = input().rstrip().split()
P = [0] * N
for i in range(N):
  P[i] = int(a[i])
minP = P[0]
ans = 1
for i in range(N - 1):
  if minP >= P[i + 1]:
    ans += 1
    minP = P[i + 1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = [int(i) for i in input().split()]
small = p[0]
count = 0
for i in range(n):
    if p[i] <= small:
        count +=1
    else:
        pass
    small = min(small,p[i])
print(count)

Submission status: Accepted

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n = int(input())
    p = list(map(int,input().split()))
    ans = 1
    minc = p[0]
    for i in range(n):
        if p[i] < minc:
            ans += 1
            minc = p[i]
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Accepted

Solution code:
N = int(input())

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

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


print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
minn = 10000000000
ans = 0
for i in a:
    if(minn > i):
        minn = i
        ans+=1

print(ans)

Submission status: Accepted

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

minl=[0 for _ in range(n)]

for i in range(n):
  if i==0:
    minl[0]=p[0]
  else:
    minl[i]=min(minl[i-1],p[i])
ans=sum([p[i]==minl[i] for i in range(n)])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
p.reverse
import heapq
a = [p[0]]
heapq.heapify(a)

ans=0

#調査対象のやつが合致する場合は、次の最大値にヒープを移す。
for i in range(n):
  #print(a)
  temp=heapq.heappop(a)
  if p[i]<=temp:
    ans+=1
    heapq.heappush(a,p[i])
  else:
    heapq.heappush(a,temp)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

m = 2 * (10 ** 5) + 1

cnt = 0

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

Submission status: Accepted

Solution code:
N = int(input())

min = 2 * 100000 + 1
counter = 0
for i in list(map(int, input().split())):
    if (min > i):
        min = i
        counter += 1

print(counter)

Submission status: Accepted

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

# Low Elements

### TESTCASE
test = ""
#test = \
"""
5
4 2 5 1 3
ans
3
"""

"""
4
4 3 2 1
ans
4
"""

"""
6
1 2 3 4 5 6
ans
1
"""

"""
8
5 7 4 2 6 8 1 3
ans
4
"""

"""
1
1
ans
1
"""
############
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
####### MAIN

n = int(input2())
p = tuple(map(int, input2().split()))

x = [0] * n

ans = 1
x[0] = p[0]

for i in range(1, n):
    if x[i-1] >= p[i]:
        ans += 1
        
    x[i] = min(x[i-1], p[i])
    
print(ans)

Submission status: Accepted

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

min_list = []
for i in range(n):
    if i == 0:
        min_list.append(p[i])
    else:
        min_list.append( min(min_list[i-1], p[i]) )

cnt = 0
for i in range(n):
    if i == 0:
        cnt += 1
    elif min_list[i-1] >= p[i]:
        cnt += 1

print(cnt)

Submission status: Accepted

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

    n = 0
    x = 10 ** 20
    for i in range(N):
        if x >= P[i]:
            x = P[i]
            n += 1
    print(n)

resolve()

Submission status: Accepted

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

tibi = box[0]
ans = 1
for i in range(len(box)):
  if i == 0: continue
  if box[i] <= tibi:
    tibi = box[i]
    ans += 1
    
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int,input().split()))
count = 1
min_num = L[0]

if N == 1:
    print(1)

else:
    for i in range(1,N):
        min_num = min(L[i-1],min_num)
        if L[i] <= min_num:
            count = count+1
    
    print(count)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(x) for x in input().split()]
x = a[0]
y = 0
ans = 0

for i in a:
  y = i
  if x >= y:
    ans += 1
  x = min([x, y])

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
P = list(map(int, input().split()))
cnt = 0
low = 200001
for i,p in enumerate(P):
    if p < low:
        low = p
    if p <= low:
        cnt += 1
print(cnt)

Submission status: Accepted

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

tmp=P[0]
ans=1

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

print(ans)

Submission status: Accepted

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

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

    t = min(t, p[i])

print(ans)

Submission status: Accepted

Solution code:
import heapq

n=int(input())

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

  # heapqライブラリのimport

a = []
heapq.heapify(a)  

#print(heapq.heappop(a))  # 最小値の取り出し
#print(a)

#heapq.heappush(a, -2)

cnt=0
for item in p:
    heapq.heappush(a,item)
    temp=heapq.heappop(a)
    if temp>=item:
        cnt+=1
    heapq.heappush(a,temp)
    #print(a)
print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 21:01:18 2020

@author: over-
"""

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

c=1
m=int(P[0])
for i in range(1,N):
    if m>int(P[i]):
        c+=1
        m=int(P[i])


print(c)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans=0
m=p[0]
for i in p:
  if i <= m:
    ans+=1

  m = min(i,m)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = int(raw_input())
b = raw_input().split(" ")

s = 1000000000
c = 1
for i in range(len(b)-1):
  cur = int(b[i])
  nex = int(b[i+1])
  if cur < s:
      s = cur

  if s < nex:
    continue



  c += 1
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

c = 0
X = []
for i in range(N):
    T = "go"
    X.append(P[i])
    x = min(X)
    X = [x]
    if P[i] > x:
        T = "end"
    if T == "go":
        c +=1
print(c)

Submission status: Accepted

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

k=2*10**5+1
m=0
for i in range(n):
    if l[i]<k:
        k=l[i]
        m+=1
print(m)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

MIN = P[0]
ans = 1
for i in range(2, N+1):
  if MIN < P[i-1]:
    pass
  else:
    ans += 1
    
  if MIN > P[i-1]:
    MIN = P[i-1]
print(ans)

Submission status: Accepted

Solution code:
import heapq
n=int(input())
q=[]
p=list(map(int,input().split()))
ans=1
flag=0
q.append(p[0])
heapq.heapify(q)
for i in range(1,n):
  if n==1:
    ans=1
    break
  if p[0]==1:
    break
  if p[i]<q[0]:
    #print("i",i,q[0])
    ans+=1
  heapq.heappush(q,p[i])
print(ans)

Submission status: Accepted

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

count = 0
min_num = 2 * 10**5

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

sum = 0
min = a[0]

for kk in range(n):
    if a[kk] <= min:
        sum += 1
        min = a[kk]
        
print(sum)

Submission status: Accepted

Solution code:
n = int(input())

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

a = 0
m = n + 1
qs = []
for i in range(n):
    if m >= ps[i]:
        a += 1
    qs.append(ps[i])
    m = min(m,ps[i])
    if ps[i] == 1:
        break

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

r = 0
x = 200001
for num in P:
  if x >= num:
    r += 1
    x = num
print(r)

Submission status: Accepted

Solution code:
N = input()
P = input().split()

N = int(N)
P =[int(p) for p in P] 


count = 0

minimum=N

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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


ans = 1

if n > 1:

    count = 0
    least = pn[0]

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

    ans += count

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


def _result(p):
    sum = 0
    m = p[0]
    for i in range(0, len(p)):
        if p[i] > m:
            pass
        else:
            m = p[i]
            sum += 1
    return sum


print(_result(p))

Submission status: Accepted

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

memory = p[0]
count = 0

for i in p:
  if i <= memory:
    count += 1
    
  if i < memory:
    memory = i

print(count)

Submission status: Accepted

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

c=0
mini=p[0]
for i in range(n):
  if mini>=p[i]:
    c=c+1
    mini=p[i]
    
print(c)

Submission status: Accepted

Solution code:

N = int(input())

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

min_p = 2*10**6

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

print(ans)

Submission status: Accepted

Solution code:
def func():
    return

n = int(input())
# s = input()
# a, b = map(int, input().split())
p = list(map(int, input().split()))
# a = input().split()

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    p = list(map(int, input().split(" ")))

    count = 0
    min_num = 10000000
    for i in p:
        if i < min_num:
            count = count + 1
            min_num = i

    print(count)

Submission status: Accepted

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

cum_min = [0] * n

min_p = 1e9
for i in range(n):
    cum_min[i] = min(min_p, ps[i])
    min_p = cum_min[i]

count = 0
for i in range(n):
    if cum_min[i] == ps[i]:
        count += 1

print(count)

Submission status: Accepted

Solution code:

def calc(n, p):
    min_p = 200000

    count = 0
    
    for i in p:
        # 最小値更新
        if (min_p >= i):
            min_p = i
        if (min_p >= i):
            count += 1

    print(count)


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

calc(n, p)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 1
min = l[0]
for i in range(1, N):
  if min > l[i]:
    count = count+1
    min = l[i]
    
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,N):
    m=min(m,P[i-1])
    if m>P[i]:
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
n = int(input())
a =        list( map(int, input().split()) )	# 1 2 3 4 5 ...


ans=0
x=a[0]

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

print(ans)

Submission status: Accepted

Solution code:
N, *D = [list(map(int, s.split())) for s in open(0)]
N, D = N[0], D[0]

cnt = 1
min_v = D[0]
for i in range(1, len(D)):
    if min_v >= D[i]:
        cnt += 1
        min_v = D[i]
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

A = []

m = N+1
for i in range(N):
    if m>P[i]:
        m=P[i]
    if m>=P[i]:
        A.append(i)

print(len(A))

Submission status: Accepted

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