Problem:


Score : 300 points

Problem Statement

Given is a permutation P_1, \ldots, P_N of 1, \ldots, N.
Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:  

For any integer j (1 \leq j \leq i), P_i \leq P_j.

Constraints

1 \leq N \leq 2 \times 10^5

P_1, \ldots, P_N is a permutation of 1, \ldots, N.  

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
P_1 ... P_N

Output

Print the number of integers i that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

i=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.

Similarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.

Sample Input 2

4
4 3 2 1

Sample Output 2

4

All integers i (1 \leq i \leq N) satisfy the condition.

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only i=1 satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C - Low Elements
N = int(input())
P = list(map(int,input().split()))
m = N+1
ans = 0
for p in P:
    m = min(m,p)
    if p==m:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
nums = list(map(int, input().split()))
before_min = 10**6
answer = 0
for num in nums:
  if num <= before_min:
    answer += 1
    before_min = min(before_min, num)
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int, input().split()))
c = 1
minv = P[0]  # その数より左にあるかずは全大きくさくなければならない
for i in range(1, len(P)):
    if minv > P[i]:
        c += 1
    minv = min(minv, P[i])
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
count=0
min=2*10**5
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()))

maxp = 999999
cnt=0

for x in p:
    if maxp >= x:
        cnt += 1
        maxp = x

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

m = N
ans = 0

for i in P:
    if m >= i:
        ans = ans + 1
        m = i
print(ans)

Submission status: Accepted

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

num = float("inf")
ans = 0

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

Submission status: Accepted

Solution code:
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
p = li()

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

Submission status: Accepted

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

min_num = N+1
ans = 0

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

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int, input().split()))
P_min = P[0]
cnt = 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())
p = list(map(int, input().split()))
s = [0]*(n+1)
l =0
s[0] = 100000000000
for i in range(n):
  s[i+1]=min(s[i],p[i])
for j in range(n):
  if(s[j]>=p[j]):
    l+=1
print(l)

Submission status: Accepted

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

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(N-1):
  m[i+1] = min(m[i], p[i+1])

# 各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=list(map(int,input().split()))
temp=p[0]
ans=0
for i in p:
    if i<=temp:
        ans+=1
    temp=min(temp,i)
print(ans)

Submission status: Accepted

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

# 各時点での最小値を求める
m = [0]*(N)
m[0] = p[0]
for i in range(N-1):
  m[i+1] = min(m[i], p[i+1])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
n = float("INF")
count = 0
for i in P:
  if n >= i:
    n = i
    count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
l = input().split()
p = []
for i in range(N):
    p.append((int(l[i]),i))

p.sort()

s = N
ans = 0
for i in range(N):
    (a,b) = p[i]
    if b < s:
        ans += 1
        s = b
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
A=list(map(int,input().split()))
minA=A[0]
ans=0
for i in range(n):
    if A[i]<=minA:
        ans+=1
        minA=min(A[i],minA)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    P = list(map(int, readline().split()))
    cur = N + 1
    ans = 0
    for x in P:
        if cur > x:
            ans += 1
            cur = x

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

num = P[0]
count = 1

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

MIN = 20000000
cnt = 0
for n in range(len(P)):
    if MIN > P[n]:
        cnt += 1
        MIN = P[n]

print(cnt)

Submission status: Accepted

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

a=n
c=0

for i in p:
    if i<=a:
        a=i
        c+=1
print(c)

Submission status: Accepted

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

min_val = n + 1
count = 0
for x in p:
    if x < min_val:
        min_val = x
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    n = int(input())
    a = np.array(read().split(), np.int32)
    mina = np.minimum.accumulate(a)
    r = np.count_nonzero(mina >= a)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    n, *a = map(int, read().split())

    p = np.array(a)
    minp = np.minimum.accumulate(p)
    r = np.count_nonzero(minp >= p)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    n, *a = map(int, read().split())

    p = np.array(a)
    minp = np.minimum.accumulate(p)
    r = 0
    for i1, ae in enumerate(a):
        r += minp[i1] >= ae

    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

cnt=0
num=max(l)

for i in l:
  num=min(num,i)
  if num==i:
    cnt+=1
    
print(cnt)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())

    r = 0
    minp = a[0]
    for i1 in range(n):
        if minp >= a[i1]:
            r += 1
            minp = a[i1]

    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    p_lst = list(map(int, input().split()))

    min_val = n + 1
    ans = 0

    for i in range(n):
        if min_val >= p_lst[i]:
            min_val = p_lst[i]
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    p_lst = list(map(int, input().split()))

    min_val = n + 1
    ans = 0

    for i in range(n):
        if min_val > p_lst[i]:
            min_val = p_lst[i]
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

min_ = math.inf
ans = 0
for p in P:
    ans += p <= min_
    min_ = min(min_, p)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

min = 1e8
n = 0

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

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

def main():
    N = int(input())
    P = list(map(int, input().split()))
    min_so_far = sys.maxsize
    ans = 0
    for p in P:
        if p <= min_so_far:
            ans += 1
            min_so_far = p
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    N = int(input())
    P = list(map(int, input().split()))
    ans = 0
    mini = INF
    for i in range(N):
        ans += mini >= P[i]
        mini = min(mini, P[i])
    print(ans)


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

c_min = P[0]
cnt = 1

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

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

ans = 1
minVal = p[0]

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

cnt = 0
m = 2 * 10 ** 5 + 1
for i in range(N):
    if P[i] <= m:
        m = P[i]
        cnt += 1
print(cnt)

Submission status: Accepted

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

cnt = 0
minimun = max(l)
for i in range(n):
    if l[i] <= minimun:
        cnt += 1
        minimun = l[i]
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
curmin = 2*10**5+1
ans = 0

for i in p:
    if curmin >= i:
        curmin = min(curmin, i)
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i,p in enumerate(P) :
    if i == 0 :
        minlist.append(p)
        continue

    if p < minlist[i-1] :
        minlist.append(p)
    else:
        minlist.append(minlist[i-1])
    
for i,p in enumerate(P) :
    pj_min = minlist[i]
    if p <= pj_min :
        count += 1
    
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def resolve(in_):
    N = int(next(sys.stdin.buffer))
    P = map(int, next(sys.stdin.buffer).split())

    min_ = 200001
    ans = 0
    for p in P:
        if p <= min_:
            ans += 1
            min_ = p
    return ans


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
L=list(map(int,input().split()))
num=1
min_num=0
for i in range(n):
    if i==0:
        min_num=L[0]

    elif min_num>=L[i]:
        num+=1
        min_num=L[i]

print(num)

Submission status: Accepted

Solution code:
'''
Created on 2020/08/17

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N=int(pin())
  P=list(map(int,pin().split()))
  ans=0
  m=P[0]
  for i in range(N):
    if m>=P[i]:
      m=P[i]
      ans+=1
  print(ans)
  return 

main()

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int,input().split()))
tmp = float('inf')
cnt = 0
for i,p in enumerate(P):
    if p <=tmp:
        cnt += 1
    tmp = min(tmp,p)
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

minP = 0
ans = 0
for i in range(N):
    if i == 0:
        ans += 1
        minP = P[0]
        continue
    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()))
sai = p[0]
answer = 1
for i in range(1,n):
    if p[i-1]<=sai:
        sai=p[i-1]
    if sai >= p[i]:
        answer = answer + 1
print(answer)

Submission status: Accepted

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

c = 1
a = d[0]

for i in range(1,N):
  if d[i] <= a:
    c += 1
    a = d[i]

print(c)

Submission status: Accepted

Solution code:
number = int(input())
score = list(map(int,input().split()))
minn = score[0]
answer = 0
for i in range(number):
    if minn >= score[i]:
        answer += 1
        minn = score[i]
print(answer)

Submission status: Accepted

Solution code:
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    n = int(input().rstrip())
    past_max = float("inf")
    ans = 0
    for p in [int(p) for p in input().rstrip().split(" ")]:
        if p < past_max:
            past_max = p
            ans += 1
    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
input()
P=map(int,input().split())
ans,mn=0,2*10**5
for x in P:
    if mn>=x: ans+=1; mn=x
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N = I()
    P = LI()
    ans = 0
    min_num = P[0]
    for i in range(N):
        if min_num>=P[i]:
            ans += 1
            min_num = P[i]

    print(ans)

main()

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
P = inpl()

min = 10**5 * 2 + 10
cnt = 0
for p in P:
    if min >= p:
        min = p
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
score=0
min_val=A[0]
for i in A:
  if i<=min_val:
    score+=1
    min_val=i
print(score)

Submission status: Accepted

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

ans=0

min_=p[0]

for pp in p:
  min_=min(min_,pp)
  if min_ ==pp:
    ans+=1

print(ans)

Submission status: Accepted

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

lmin=10**10
ans=0

for pp in p:
    ans+=1 if pp<=lmin else 0
    lmin=min(pp,lmin)

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, P: "List[int]"):
    ans = 0
    l = INF
    for pi in P:
        l = min(l, pi)
        if pi <= l:
            ans += 1
    return ans


def main():

    sys.setrecursionlimit(10 ** 6)

    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]"
    print(f'{solve(N, P)}')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline().rstrip())
P = [int(x) for x in sys.stdin.readline().rstrip().split()]

m = N  # iの前までの最小
cnt = 0
for i in range(N):
    if m >= P[i]:
        cnt += 1
    m = min(m,P[i])

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#C - Low Elements
N = int(input())
P = list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
import os, sys, re, math

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

answer = 0
m = 2 * 10 ** 5
for p in P:
    if p <= m:
        answer += 1
        m = p

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
min_val = 10 ** 8
for p in P:
    if p <= min_val:
        min_val = p
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

min = p_list[0];
count = 0;
for i in range(len(p_list)):
  if (min >= p_list[i]):
    count += 1;
    min = p_list[i];

print(count);

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
minnumber=1e9
count=0

for i in p:
  if i<=minnumber:
    count+=1
    minnumber=i
    
print(count)

Submission status: Accepted

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

cnt = 0
p_min = 2*10**5+1
for i in range(n):
    if p_min >= p[i]:
        cnt += 1
    p_min = min(p_min, p[i])

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

m = P[0] #その時点での最小値
cnt = 1 #P[0]の時点でcnt=1
for i in range(N):
    if P[i] < m:
        m = P[i]
        cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


for i in P:
    if i == 1:
        ans += 1
        x = 1
    else:
        if x >= i:
            ans += 1
            x = i



            
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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