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: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(i_count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

    n = 0
    for i in range(N):
        for j in range(i):
            if P[i] > P[j]:
                break
        else:
            n += 1
    print(n)
    
resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = [1 for i in range(n)]

for i in range(n):
    for j in range(i+1, n):
        if num[i] < num[j]:
            ans[j] = 0
            
print(sum(ans))

Submission status: Time Limit Exceeded

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

count = 0
for i in range(1, n + 1):
  if min(numList[:i]) == numList[i-1]:
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n=int(input())
pl=list(map(int, input().split()))

pl=np.array(pl)

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

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

cnt = 0
for i in range(N):
  if min(a_list[:i+1]) >= a_list[i]:
    cnt += 1
    
print(cnt)

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(N):
    f = True
    for j in range(i, -1, -1):
        if P[i] > P[j]:
            f = False
            break
    if f == True: ans += 1


print(ans)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left

N=int(input())
Pn=list(map(int, input().split()))
cnt = 0
for i in range(N):
    p_i = Pn[i]
    p_j = min(Pn[:i+1])
    if p_i <= p_j:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
P=list(map(int,input().split()))
ans=1
for i in range(n-1):
    now=P.pop(-1)
    if min(P)>now:
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

c = 0
for i in range(N):
    f = True
    pi = P[i]
    for j in range(i):
        if pi>P[j]:
            f = False
            break
    if f:
        c += 1
print(c)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

cnt = 1

for i in range(1, N):
  for j in range(i-1, -1, -1):
    if P[i] > P[j]:
      break
  else:
    cnt += 1


print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
P = np.array(list(map(int, input().split())))

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

Submission status: Time Limit Exceeded

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

ans = 0
for i,p in enumerate(Ps):
  if p==min(Ps[:i+1]):
    ans += 1
  if p==1:
    break
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

cnt = 0

for i in range(N):
    if i == 0:
        cnt += 1
    else:
        if all(list(map(lambda x:x > P[i], P[:i]))):
            cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

print(sum(l[i] == min(l[:i+1]) for i in range(n)))

Submission status: Time Limit Exceeded

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

count = 0
for i in range(n):
    if i == 0:
        count += 1
    elif min(P[i], min(P[:i])) == P[i]:
        count += 1

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans=0
for i in range(N):
  flag=True
  for j in range(i):
    if P[i]>P[j]:
      flag=False
      break
  if flag:
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

cnt = 1
for i in range(1,N):
    for j in range(0,i):
        if A[i] > A[j]:
            break
    else:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

con = 0

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

print(con + 1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

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

# 自分より左にいるやつが、全員自分以上であるような要素の数
counter = 0
for i in range(N):
    if np.all(P[:i+1] >= P[i]):
        counter += 1
print(counter)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

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


def solve(N: int, P: "List[int]"):
    ans=1
    for i in range(1,N):
        if P[i]<=min(P[:i]):
            ans+=1
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
# coding:utf-8

N = int(input())
P = [int(el) for el in input().split(' ')]
ans = 1

for i, p in enumerate(P):
    if i == 0:
        continue
    flag = True
    for j in range(i):
        if p > P[j]:
            flag = False
    if flag:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

for i in range(N):
  for j in range(i):
    if P[i]>P[j]: 
      ans -= 1
      break
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(len(A)):
  flag=1
  for j in range(0,i):
    if A[i]>A[j]:
      flag=0
      break
  if flag==1:
    ans+=1
print(ans)

Submission status: Time Limit Exceeded

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)

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

print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()

ans = 0
for i in range(n):
    pi = p[i]
    flag = True
    for j in range(i, -1, -1):
        if pi > p[j]:
            flag = False
    if flag ==True:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

#a, b = map(int, input().split())
N = int(input())

#map(int, input().split())

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

cnt = 1

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
L = [n for n in map(int,input().split())]
res = 0
k = 0
for i in range(0,N):
  for j in range(0,i):
    if L[i] > L[j]:
      k = 1
  if k!=1:
    res += 1
  k = 0
print(res)

Submission status: Time Limit Exceeded

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

ans = n
for i in range(n):
    for j in range(i):
        if p[j] < p[i]:
            ans -= 1
            break

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
n = int(input())
P = [int(x) for x in input().split(" ")]

def check(i):
    flag = True
    for j in range(i):
        if P[j] < P[i-1]:
            flag = False
            break
    if flag:
        return 1
    else:
        return 0
ans = 0
for i in range(1,n+1):
    ans += check(i)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(N):
  for j in range(i):
    f = True
    if P[i] >= P[j]:
      f = False
      break
  else:
    ans += 1
print (ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

res = 0
for i in range(N):
  for j in range(i):
    if P[i] <= P[j]:
      continue
    else:
      break
  else:
    res += 1
print(res)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

temp = arr.index(1)
ans = 1

while(temp!=0):
    val = arr[:temp].index(min(arr[:temp]))
    ans += 1
    temp = val
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(x) for x in input().split()]
ans = 0
for i in range(N):
    for j in range(i,-1,-1):
        if P[i] > P[j]:
            break
    else:
        ans += 1
print(ans)

Submission status: Accepted

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

min_num = 1001001001
ans = 0
for p in pl:
    if p <= min_num:
        ans += 1
        min_num = p

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

min = p[0]
count = 1

for i in range(1,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 = 200002
for p in P:
    if p <= m:
        m = p
        ans += 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P_ls = map(int, input().split(' '))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

Submission status: Accepted

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

cnt = 1
min_n = S[0]
for n in S[1:]:
  #print(min_n,n)
  if n <= min_n:
    min_n = n
    cnt += 1
    
print(cnt)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
min = num_list[0]
for i in range(n):
    if num_list[i] <= min:
        min = num_list[i]
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P_ls = list(map(int, input().split(' ')))
min_val = 10 ** 6
rst = 0
for i in P_ls:
    if i <= min_val:
        rst += 1
        min_val = i
print(rst)

Submission status: Accepted

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

count = 0
min_num = float('inf')
for i in P:
    if i < min_num:
        count += 1
        min_num = i

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8

def main():
    N = int(input())
    tmp = 200001
    ans = 0
    A = list(map(int, input().split()))

    for a in A:
        if a < tmp:
            ans += 1
            tmp = a

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

n = int(input())
p = list(map(int,input().split()))
min = sys.maxsize
cnt = 0

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

print(cnt)

Submission status: Accepted

Solution code:
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

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

main()

Submission status: Accepted

Solution code:
n = int(input())
L = list(map(int,input().split()))
mini = L[0]
ans = 0

for l in L:
  if mini >= l:
    ans += 1
    mini = l
print(ans)

Submission status: Accepted

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

min_v=P.popleft()
cnt=1
while P:
	temp=P.popleft()
	if temp<=min_v:
		cnt+=1
		min_v=temp

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

for i in range(1,n):
  if m >=x[i]:
    count+=1
    m = x[i]
  
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
    _ = int(input())
    P = [int(x) for x in input().split()]

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
T = [P[0]]+[10**10]*(N-1)
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
T = [P[0]]+[10**10]*(N-1)
ans = 0

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

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

print(ans)

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[]
    n = int(input())
    numbers=list(map(int,input().split()))
    small=0
    dp=[]

    for idx,data in enumerate(numbers):
        if idx == 0:
            small=data
            dp.append(data)
        elif data < small:
            small=data
            dp.append(data)
        else:
            continue
    print(len(dp))

if __name__=="__main__":
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P_ls = list(map(int, input().split(' ')))
rst, min_val = 0, 10 ** 6
for i in P_ls:
    if min_val >= i:
        rst += 1
        min_val = i
print(rst)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
mini = float('inf')

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    P=LI()
    m=P[0]
    cnt=1
    for i in range(1,N):
        if P[i]<m:
            cnt+=1
            m=P[i]
            
    print(cnt)

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

S = sorted(P, reverse = True)
cn = 0
L = []



for i in range(N):
    if i == 0:
        cn = cn + 1
        L.append(P[i])

    else:
        if P[i] > L[0]:
            continue
                
        else:
            cn = cn + 1
            L.append(P[i])
            L.pop(0)


print(cn)

Submission status: Accepted

Solution code:
import sys
import copy
import math
import itertools
import numpy as np
N = int(input())
P = [int(c) for c in input().split()]

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

Submission status: Accepted

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

ans = 0
check = 10**9 + 7

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

ans=0
tempmin=P[0]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
p = list(map(int, input().split()))
 
# 条件はN=O(10^5)よりO(N)で解く
# 二重ループをすると、O(N^2)で間に合わない
# 累積和の問題（ABC-154-Dとか）と同じ発想が使える！
 
# 具体的にO(N)で解くために、最初に各iに対して、i番目までの最小値を求めておく
m = [0]*(N)
m[0] = p[0]
for i in range(1, N):
  m[i] = min(m[i-1], p[i])

# 各iまでの最小値とi番目の値を比較し、最小値の方が大きければよい
ans = 1
for i in range(1, N):
  if m[i-1] >= p[i]: ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = [int(i) for i in input().split()]
cnt = 0
min_ = float('inf')
for pi in p:
  if pi < min_:
    cnt += 1
    min_ = pi
print(cnt)

Submission status: Accepted

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

# import numpy as np
# from itertools import combinations as comb
# from bisect import bisect_left, bisect_right, insort_left, insort_right
# from collections import Counter


def solve(N: int, P: "List[int]"):
    min_p = P[0]
    count = 0
    for p in P:
        if p <= min_p:
            min_p = p
            count += 1

    return count


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    answer = solve(N, P)
    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

mini = 10**9
ans =0 

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

Submission status: Accepted

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

Submission status: Accepted

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

min_p = 2 * 10**5 + 1
ans = list()
for i, v in enumerate(p, 1):
  if min_p > v:
    min_p = v
    ans.append(v)

print(len(ans))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Sep  8 02:46:31 2020

@author: liang
"""

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

low = P[0]
count = 0

for p in P:
    if low >= p:
        low = p
        count += 1
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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