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:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = -inf ;count = 0 ;pro = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input().split()[0])
p_list = list(map(int, input().split()))
# p_list = p_list[::-1]
min_p = p_list[0]
c = 0
for p in p_list:
    if p <= min_p:
        c += 1
        min_p = p

ans = c

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

temp_val = 2*(100000)+1

count = 0

for p in plist:
    if p < temp_val:
        temp_val = p
        count += 1

print(count)

Submission status: Accepted

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

ans = 1
P_min = P[0]
for i in range(1, N):
    if P[i] < P_min:
        ans += 1
    P_min = min(P_min, P[i])
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())
p = list(map(int,input().split()))
ans=0
m=[]
m.append(p[0])
for i in range(1,n):
    m.append(min(p[i],m[i-1]))

for i , j in zip(p,m):
    if i <= j:
        ans+=1
print(ans)

Submission status: Accepted

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

ans = 0

# 各部分列の最小値
minval = max(P)
# for i in range(N):
for x in P:
    # arr = P[0],...,P[i]の最小値
    minval = min(minval,x)

    # P[i]が最小値以下なら
    if x <= minval:
        ans += 1
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = [int(s) for s in input().split()]
count = 1
minval = P[0]
for i in [idx+1 for idx in range(N-1)]:
  if minval > P[i]:
    count += 1
    minval = P[i]
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

mina = 200001
count = 0
for v in a:
    if v <= mina:
        mina = v
        count += 1

print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
P = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
minv = N + 1
for i in range(N):
    if P[i] < minv:
        minv = P[i]
        count += 1
print(count)

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    lst =list(map(int,input().split()))
    mn = lst[0]
    counter = 1
    for i in range(1,len(lst)):
        if lst[i] < mn:
            mn = lst[i]
        if lst[i] <= mn:
            counter += 1

    print(counter)




if __name__ == '__main__':
    main()

Submission status: Accepted

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

count = 0
mini = 1e6

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

print(count)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

mn = 9999999999
ct = 0
for i in range(n):
    if mn > a[i]:
        ct += 1
        mn = a[i]
print(ct)

Submission status: Accepted

Solution code:
#これまでのminを保存しておく
n=int(input())
p=list(map(int,input().split()))
ans=0
P=p[0] #min
for i in range(n):
  if p[i]<=P:
    ans+=1
    P=p[i]

print(ans)

Submission status: Accepted

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

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

counter = 0
Min = p[0]

for i in range(n):
  if i == 0:
    counter += 1
  else:
    if p[i] <= Min:
      counter += 1
      Min = p[i]
  
print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    data = [int(s) for s in input().split(" ")]
    low = data[0]
    count = 0
    for i in data:
        if low >= i:
            count += 1
            low = i
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
numlist = list(map(int, input().split()))
del numlist[n::]

count = 0
minnum = max(numlist)
for i in numlist:
  if minnum >= i:
    minnum = i
    count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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


ans = 1

l = [p[0]]

heapq.heapify(l)

for i in range(1,n):
    tmp = heapq.heappop(l)
    heapq.heappush(l,tmp)




    if p[i] < tmp:
        ans +=1

    heapq.heappush(l,p[i])

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
x = N + 1
for p in P:
    if x > p:
        cnt += 1
    x = min(x, p)

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    p = [int(i) for i in input().split()]
    min = 0
    count  =0
    for i in p:
        if min ==0 or min >= i:
            count = count +1
            min = i
    print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# ABC152c


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    n = int(input())
    p = list(map(int, input().split()))

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 1
m = pi[0]
for i in range(1, n):
    if pi[i] <= m:
        ans += 1
        m = pi[i]

print(ans)

Submission status: Accepted

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

c = 1
pmin = 1000000
for i in range(1,N):
    if P[i-1]<pmin:
        pmin = P[i-1]
    if pmin >= P[i]:
        c += 1
print(c)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys


def main():
    n = int(sys.stdin.readline().strip())
    p = [int(num_s) for num_s in sys.stdin.readline().strip().split(' ')]

    smallest = float('inf')

    ans = 0
    for pi in p:
        if pi <= smallest:
            ans += 1
        smallest = min(smallest, pi)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

smallest = p[0]
omitted = 0
for i in range(1,n):
    if p[i] > smallest:
        omitted += 1
    else:
        smallest = p[i]


print(n - omitted)

Submission status: Accepted

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

ans = 1
index = P[0]

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

res = 0
mn = 1e1000

for a in A:
    if mn >= a:
        res += 1
    mn = min(mn, a)
print(res)

Submission status: Accepted

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

lowest = 2 * 10 ** 5 + 1000
cnt = n
for i in range(n):
    if lowest < p[i]:
        cnt -= 1
    lowest = min(lowest, p[i])
print(cnt)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
S = input()
Ps = np.fromstring(S, dtype=int, sep=" ")

min_val = Ps[0]
count = 1
for i in range(1, N):
    if min_val >= Ps[i]:
        count += 1
        min_val = Ps[i]

print(count)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

mn = N+1
cnt = 0
for i in range(N):
    #print(i, mn, cnt)
    a = A[i]

    if a < mn:
        mn = a
        cnt += 1

print(cnt)

Submission status: Accepted

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

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

ans = 0
m = float("inf")
for p in P:
    if p <= m:
        ans += 1
    m = min(m, p)

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
N=int(input())
P=list(map(int,input().split()))
#P.insert(0,0)
M=[0]*N
M[0]=P[0]
for i in range(N-1):
    M[i+1]=min(M[i],P[i+1])
#print(P)
#print(M)
ans=0
for i in range(N):
    if P[i]<=M[i]:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

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

print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

min_p = 1*10**9-1
MIN_P_LIST = []
for p in P:
    MIN_P_LIST.append(min_p)
    min_p = min(min_p, p)

#print(P)
#print(MAX_P_LIST)

ans = 0
for p, m_p in zip(P, MIN_P_LIST):
    if m_p >= p:
        ans += 1 
        
print(ans)

Submission status: Accepted

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

mi = n+1
ans = 0
for i in a:
    if mi>=i:
        ans+=1
    mi = min(mi,i)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
r = 0
for x in map(int, input().split()):
  if x <= n:
    n = x
    r += 1
print(r)

Submission status: Accepted

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

MIN = 10**9

cnt = 0
for p in P:
    if MIN >= p:
        cnt += 1
        MIN = p

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import bisect
n = int(input())
p_ls = [int(i) for i in sys.stdin.readline().split()]
ls = [10**18]
_min = 10**18
cnt = 0
for p in p_ls:
    if p <= _min:
        cnt += 1
        _min = p
print(cnt)

Submission status: Accepted

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

cnt = 0
min_j = float("inf")
for i in p:
    if i <= min_j:
        cnt += 1
    min_j = min(min_j, i)

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

minp = p[0]
ans = 1

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

Submission status: Accepted

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

count = 0
min_p = None
for i in range(n):
    if min_p is None or p[i] < min_p:
        min_p = p[i]
    if p[i] <= min_p:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
P=list(map(int,input().split()))
ans=0
m=10**7
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()))

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

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
min = 2*(10**5) + 1
for i in range(N):
  if min >= P[i]:
    sum = sum + 1
    min = P[i]

print(sum)

Submission status: Accepted

Solution code:
N=int(input())
P = [int(i) for i in input().split()]
ans = 0
minimum = N+1
for p in P:
    if p<=minimum:
        ans += 1
        minimum = p
print(ans)

Submission status: Accepted

Solution code:
# 2020/01/19
# AtCoder Beginner Contest 152 - C

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

min = 10 ** 6
ans = 0

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

# Output
print(ans)

Submission status: Accepted

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

minNum = nums[0]
count = 0
for i in range(N):
    minNum = min(minNum, nums[i])
    if minNum >= nums[i]:
        count += 1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#a, b = map(int, input().split())
N = int(input())
P = list(map(int, input().split()))

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

border = N + 1
ans = 0

for i in P:
    if i < border:
        ans += 1
        border = i

print(ans)

Submission status: Accepted

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

r = 1
old = P[0]
new = 0
for i in range(N-1):
    new = P[i+1]
    if (new < old):
        r += 1
        old = P[i+1]


print(r)

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    P=tuple(map(int,input().split()))
    c=0
    m=P[0]
    for p in P:
        if m>=p: c += 1
        if p==1: break
        m=min(m,p)
    print(c)
main()

Submission status: Accepted

Solution code:
def run():
  N = int(input())
  P_li = list(map(int, input().split()))
  smallest = P_li[0]
  ans = 0
  for p in P_li:
    if smallest >= p:
      ans += 1
      smallest = p
    else:
      continue
  print(ans)
    

if __name__ == '__main__':
  run()

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

    ans = 0
    min_element = p[0]

    for p_i in p:
        if p_i <= min_element:
            ans += 1
            min_element = p_i

    print(ans)
    
resolve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
m=float('INF')
ans=0

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())
num_list = list(map(int, input().split(" ")))
min = 200001
count = 0

for i in num_list:
    if min >= i:
        count += 1
        min = i

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

m = p[0]
res = 1
for i in range(1, n):
    if p[i] > m:
        continue
    else:
        res += 1
        m = p[i]

print(res)

Submission status: Accepted

Solution code:
N = int(input())
perm = [i for i in map(int,input().split())]
perm_new = [perm[0]]
import heapq
heapq.heapify(perm_new)
ans = 1
for i in range(1,N):
  now_min = heapq.heappop(perm_new)
  if now_min >= perm[i]:
    ans += 1
  heapq.heappush(perm_new,now_min)
  heapq.heappush(perm_new,perm[i])
  
print(ans)

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

m = 200001
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from heapq import heappop, heappush
N = int(input())
P = list(map(int, input().split()))

heap = []
count = 0

for i in range(N):
    heappush(heap, P[i])
    minimum = heappop(heap)
    if minimum >= P[i]:
        count += 1
    heappush(heap, minimum)

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

ans = n
mins = 10 ** 9
for i in range(n):
    mins = min(mins, p[i])
    if mins < p[i]:
        ans -= 1

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0
minimum = np.inf

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x_min = P[0]
ans = 1

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

print(ans)

Submission status: Accepted

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

m=a[0]
ans=0
for i in a:
  if i<=m:
    ans+=1
  m=min(i,m)
  #print(m)
  
print(ans)

Submission status: Accepted

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

ls = [p[0]]
ans = 1

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

Submission status: Accepted

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

min = P[0]
ans = 0
for i in range(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()))

max_P = float('inf')
count = 0
for i in range(len(P)):
    if P[i] <= max_P:
        count +=1
        max_P = P[i]

print(count)

Submission status: Accepted

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

minP = P[0]
ans = 1
for i in range(1,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()))

mn = P[0]
ans = 1
for x in P[1:]:
    if mn >= x:
        mn = x
        ans += 1
    else:
        pass

print(ans)

Submission status: Accepted

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


def solve(N: int, P: "List[int]"):
    ans=1
    mi=P[0]
    for i in range(1,N):
        if P[i]<=mi:
            ans+=1
            mi=P[i]
            
    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: Accepted

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

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

pmin = P[0]
res = 1

for j in range(1, n):
    if P[j] <= pmin:
        res += 1
        pmin = P[j]

print(res)

Submission status: Accepted

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

buf_1 = P[0]
buf_2 = 1
for i in range(1,N) :
    if buf_1 > P[i] :
        buf_2 = buf_2 + 1
    buf_1 = min(buf_1,P[i])

print(buf_2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input()) # 数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

min = 10**9
result = 0

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

print(result)

Submission status: Accepted

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

    mn = P[0]

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

    print(cnt)    

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

mi = p[0]
for i in p:
    
    if mi >= i:
        ans += 1
        mi = i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

inf = 10 ** 9

Q = [inf] * N

m = inf

con = 0

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

print(con)

Submission status: Accepted

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

p = a[0]
res = 1
for i in a[1:]:
    if p >= i:
        res += 1
        p = i
print(res)

Submission status: Accepted

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

ans = 0
min = 200007
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()))
c=2*(10**5)+1
ans=0
for i in p:
  if c>i:
    ans+=1
    c=i
print(ans)

Submission status: Accepted

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

minn=S[0]
count=0
for i in range(len(S)):
    if minn>=S[i]:
        count=count+1
        minn=S[i]
print(count)

Submission status: Accepted

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

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:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N = one_int()

P=many_int()

count=0
mins=100000000
for i in range(N):
    flg=True
    if P[i]<mins:
        count+=1
        mins=P[i]

print(count)