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())
num = list(map(int,input().split()))
ans = 1
min = num[0]

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

print(ans)

Submission status: Accepted

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

ans = 1
Min = P[0]

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

now = 99999999
sumc = 0
for count in range(0,N):
    if P[count] < now:
        sumc += 1
        now = P[count]
print(sumc)

Submission status: Accepted

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

min_s=[P[0]+1]

ans=len([min_s.append(s) for s in P if s < min_s[-1]])
print(ans)

Submission status: Accepted

Solution code:
listA=[]

for i in range(2):
    try:
        listA.append(list(map(int, input().split())))
        #listA<-[1,2,2,3,1]
        #print(listA)
        #ここに逐次処理を書けばいいと思う。
    except:
        break;
        #または、quit(),os.exit()をして止める。

list=listA[1]

mini=float('inf')
count=0

for i in list:
    if i <= mini:
        count+=1
        mini=i

print(count)

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
MIN=10**9#Nの制約よりも十分に大きい数
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())
p = list(map(int,input().split()))
value = 1000000000
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
cnt = 0
min_num = 2 * (10 ** 5) +1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
x=[int(k) for k in input().split()]
count=0
max=n+1
for i in range(0,len(x)):
    if max>x[i]:
        count+=1
        max=x[i]
print(count)

Submission status: Accepted

Solution code:
def main(length_num,num_list):
    count_num = 0
    min_num = int(num_list[0])
    for i in num_list:
        if int(min_num) >= int(i):
            min_num = i
            count_num += 1           
    return count_num
    
if __name__ == "__main__":
    input_length_num = int(input())
    input_num2 = input()
    input_num_list = input_num2.split()
    print(main(input_length_num,input_num_list))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for ln in l:
  if m >= ln:
    m = ln
    ans+=1
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
res = [0] * n
res[0] = 1
min_ = p[0]
for i in range(1, n):
    if min_ >= p[i]:
        res[i] = 1
        min_ = p[i]
print(sum(res))

Submission status: Accepted

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

cnt = 0
m = N

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

print(cnt)

Submission status: Accepted

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

result = 0
min_value=P[0]
for index, current_value in enumerate(P):
  if (min_value >= current_value):
    result += 1
    min_value = current_value

print(result)

Submission status: Accepted

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

# https://atcoder.jp/contests/abc152/submissions/9602537
def solve(N: int, P: "List[int]"):
    P = np.array(P)
    Q = np.minimum.accumulate(P)
    # print(np.count_nonzero(P<=Q))
    print(np.sum(P<=Q))



# 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: Accepted

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


def solve(N: int, P: "List[int]"):
    minp = P[0]
    cnt = 1
    for i in range(1, N):
        if P[i]<minp:
            minp = P[i]
            cnt += 1
    print(cnt)


# 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: Accepted

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

# count = 0
# val = sum(p[0:k])
# val_lis = [val]
# mx_val = val
# index = 0
# mx_index = 0
# for i,j in enumerate(p[k:]):
#     val = val - p[index] + j
#     val_lis.append(val)
#     index +=1
#     if val > mx_val:
#         mx_index = index
#         mx_val = val 
    
# ans = 0
# for i in range(k):
#     ans += ((p[mx_index + i]+1.0)*(p[mx_index+i]))/ (p[mx_index+i] *2.0)
# print(ans)  




# h = sorted(h,reverse = True)
# print(sum(h[k:]))

# s,t= map(str, input().split())
# a,b= map(int, input().split())
# u = input()
# print("x"*len(u))

# if(u == s):
#     print(a-1,b)
# else:
#     print(a,b-1)

Submission status: Accepted

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

cnt = 1
min_p = p[0]

if n == 1:
    print(n)
else:
    for i in range(1, n):
        if p[i] < min_p:
            min_p = p[i]
            cnt += 1
    print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
min_ = float("inf")
for n in seq:
    if n < min_:
        min_ = n
        count += 1

print(count)

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 solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    p = list(map(int, readline().split()))
    t = 10 ** 6
    cnt = 0
    for i in range(n):
        t = min(t, p[i])
        if t >= p[i]:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

P_min = N + 1
result = 0

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

print(result)

Submission status: Accepted

Solution code:
n, *p_n = map(int, open(0).read().split())

count = 0
min_num = p_n[0]
for p in p_n:
    if p <= min_num:
        min_num = p
        count += 1
print(count)

Submission status: Accepted

Solution code:
n, *p_n = map(int, open(0).read().split())

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

Submission status: Accepted

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

import sys

def solve(n, ps):
    pmin = ps[0]
    c = 0
    for i in range(0, len(ps)):
        if ps[i] <= pmin:
            pmin = ps[i]
            c += 1
    return c

def main():
    n = int(sys.stdin.readline().strip())
    nstr = sys.stdin.readline().strip()

    ps = []
    i = 0
    for c in range(0, n):
        iend = nstr.find(" ", i)
        if iend < 0:
            iend = len(nstr)
        ps.append(int(nstr[i:iend]))
        i = iend + 1

    ans = solve(n, ps)

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

minValue = P[0]

for i, p in enumerate(P):
  if (minValue >= p):
    result += 1
    minValue = p

print(result)

Submission status: Accepted

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

ans = 0
min = N+1

for i in list_P :
    if i < min :
        ans += 1
        min = i

print(ans)

Submission status: Accepted

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

mn = 1000000000000
ans = 0
for i in range(n):
  if a[i] < mn:
    ans += 1
    mn = a[i]
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,n):
    if p_lst[i]<=p_min:
        number += 1
        p_min = p_lst[i]

print(number)

Submission status: Accepted

Solution code:
from numpy import *

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

l = zeros(N+1, dtype=int)

l[0] = P[0]
j = 0
for i in range(1, N):
    if P[i] < l[j]:
        l[j+1] = P[i]
        j += 1
    else:
        pass


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

print(count)

Submission status: Accepted

Solution code:
import sys
read=sys.stdin.buffer.read
N,*P=map(int,read().split())
max_val=float('inf')
cnt=0
for p in P:
  max_val=min(max_val,p)
  if max_val == p :
    cnt+=1
print(cnt)

Submission status: Accepted

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

c = 0
for i in range(N - 1):
    f = P[i]
    l = P[i + 1]
    if f < l:
        P[i] = l
        P[i+1] = f
        c += 1

print(N - c)

Submission status: Accepted

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

def main():
    N = int(input())
    a = list(map(int,input().split()))
    
    ans = 0
    num = 10**6
    for p in a:
        if p < num:
            ans += 1
            num = p
    
    print(ans)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
mini, res = n+1, 0
for i in arr:
    if i < mini:
        mini = i
        res += 1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
min_val = p[0]

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
mn=p[0]
for i in range(n):
    if mn >= p[i]:
        cnt+=1
    if p[i]<mn:
        mn = p[i]
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 range(n):
    if p[i] <= p_min:
        ans += 1
        p_min = p[i]
print(ans)

Submission status: Accepted

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

cnt = 0 
minval = int(2e5)+1

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

print(cnt)

Submission status: Accepted

Solution code:
import copy
a=int(input())
c=list(map(int, input().split()))
minnum=c[0]
ans=1
for i in range(1,a):
    if(minnum>c[i]):
        ans+=1
        minnum=c[i]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

k = 0
for i in range(len(num_list)):
    if i == 0:
        temp_min = num_list[i]
    else:
        temp_min = min(temp_min, num_list[i])
        
    if i != len(num_list)-1:
        if temp_min == num_list[i]:
            k += 1
    else:
        if temp_min == num_list[i]:
            k += 1
    
print(k)

Submission status: Accepted

Solution code:
import numpy as np
import itertools

def main():
    N = int(input())
    P = np.array([int(x) for x in input().split()])
    
    Q = np.array(list(itertools.accumulate(P, min)))

    print(np.count_nonzero(P <= Q))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

mini = float('inf')
s = 0
for i in range(n):
  if p[i] < mini:
    mini = p[i]
    s += 1
print(s)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    ans = 0
    minP = P[0]

    for i in range(N):
        minP = min(minP, P[i])
        if P[i] <= minP:
            ans += 1
    
    print(ans)
        
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

N = int(readline())

P = np.array(readline().split(), np.int32)
Q = np.minimum.accumulate(P)
ans = np.count_nonzero(P <= Q)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
P=tuple(map(int,input().split()))
ans=0
m=n+1
for p in P:
    if m>p:
        ans+=1
    m=min(m,p)
print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = map(int,input().split())
min = 2 * 10**5 + 1
ans = 0
for x in p:
    if min >= x:
        ans += 1
        min = x
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]
    else:
        continue
print(cnt)

Submission status: Accepted

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

min = P[0]
count = 0

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

print(count)

Submission status: Accepted

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

m=2*(10**5)+1
count = 0
for i in range(0, n):
  if p[i] <= m:
    m = p[i]
    count = count + 1

print(count)

Submission status: Accepted

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

count = 1
if N == 1:
  print(count)
else:
  min = P[0]
  if P[1] <= P[0]:
    count+=1
    min = P[1]

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

m = -1
ans = 0

for i, item in enumerate(P):
  if i==0:
    m = item
    ans += 1
  else :
    if (m >= item):
      m = item
      ans += 1
      
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

a=int(input())

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

e = 0
mini = i[0]
count = 0

while e < a:
    if e == 0:
        count += 1
    elif i[e] < mini:
        count += 1
        mini = i[e]
    e += 1

print(count)

Submission status: Accepted

Solution code:
num = int(input())
p = map(int, input().split())
pList = list(p)
ret = 0

min = pList[0]
for i in range(num):
    if pList[i] <= min:
        min = pList[i]
        ret = ret + 1

print("{}".format(ret))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print (count)

Submission status: Accepted

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

count = 0

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

print(count)

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())
l = list(map(int,stdin.readline().split()))
ans = 0
m = float('inf')
for u in l:
	if u<=m: m = u; ans += 1
print(ans)

Submission status: Accepted

Solution code:
# get N
N = int(input())

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

minimum = P[0]
icount = 1

for x in P[1:]:
    if minimum >= x:
        icount += 1
        minimum = x

print(icount)

Submission status: Accepted

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

res = 1
min_el = A[0]

for i in range(1, N):
    if A[i] <= min_el:
        res += 1
        min_el = A[i]

print(res)

Submission status: Accepted

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

cnt=1
min_v=p[0]

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    ans = 0;
    m = 0
    for i, p in enumerate(P):
        if p < m or i == 0:
            m = p
            ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import heapq
N = int(input())
P = list(map(int,input().split()))
heap = []
heapq.heappush(heap,10**6)
ans = 0 
m = 10 ** 6
for i in range(N):
    if heap[0] > P[i]:
        ans += 1
    heapq.heappush(heap,P[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def smaller(a,b):
  if a>b:
    return b
  else:
    return a

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

S=[P[0]]
for i in range(1,N):
  S.append(smaller(S[i-1],P[i]))
  

for i in range(N):
  if P[i]==S[i]:
    res+=1
print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = input()
P = list(map(int, input().split(" ")))
count = 0
minimum = P[0]
for i in range(len(P)):
    if P[i] <= minimum:
        count += 1
        minimum = P[i]
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
min_num = max(l) +1
ans = 0
for i in l:
  if min_num >= i:
    min_num = i
    ans += 1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

def main():
    n = int(stdin.readline().strip())
    l = list(map(int,stdin.readline().split()))
    ar = [-1 for _ in range(n)]
    ar[0] = l[0]
    ans = 1
    for i in range(1,n):
        if(l[i] <= ar[i-1]):
            ans+=1
            ar[i] = l[i]
        else:
            ar[i] = ar[i-1]
    print(ans)
        
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    m = P[0];
    cnt = 0;
    for p in P:
        if(p <= m) :
            m = p
            cnt = cnt + 1

    print(cnt)
resolve()

Submission status: Accepted

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

Min=P[0]
ans=1

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

Submission status: Accepted

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

for p in P:
    if p <= prev:
        ans += 1
    prev = min(p, prev)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())                                                                                                        
seq = [int(x) for x in input().split()]                                                                                 
cur_d = float('inf')                                                                                                    
ans = 0                                                                                                                 
for i in seq:                                                                                                               
  if i < cur_d:
    cur_d = i
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# abc152

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

std = lists[0]
ans = 1

for i in range(1,n):
    if lists[i] < std:
        ans += 1
        std = lists[i]
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input().strip())
ns = [int(x) for x in input().split(' ')]
cnt=0
mini = 200001
for i in range(len(ns)):
  if ns[i] <mini:
    cnt+=1
    mini=ns[i]
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

data = [int(s) for s in input().split()]

mi = data[0]
ans = 0
for i in range(1,len(data)):
  if data[i] <= mi:
    ans += 1
  if data[i]  < mi:
    mi = data[i]
print(ans +1)

Submission status: Accepted

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

for i in range(N):
  if min >= list[i]:
    min = list[i]
    a += 1
    
print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1
lst_min = []
for i in range(n):
    if i == 0:
        lst_min.append(lst[i])
    else:
        lst_min.append(
            min(lst_min[i-1], lst[i])
        )
        if lst_min[i] == lst[i]:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
mini = 10**6
ans = 0
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 = [int(i) for i in input().rstrip().split(' ')]
c = 0
m = 2*10**5
for i,p in enumerate(P):
    if m >= p:
        m = p
        c += 1
print(c)

Submission status: Accepted

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

count = 0
minimum = 1+2*(10**5)

for i in range(n):
    if num_list[i] <= minimum:
        count += 1
        minimum = num_list[i]

print(count)

Submission status: Accepted

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

for NextNum in P:
    if PreNum >= NextNum:
        Cor += 1
        if PreNum >= NextNum:
            PreNum = NextNum
print(Cor)

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int, input().split()))
c = 1
minimum = P.pop(0)
if minimum != 1:
    for p in P:
        if p <= minimum:
            c += 1
            minimum = p
        if p == 1:
            break
print(c)