peterverebics/CodeNet_Python_118 huggingface dataset:
def solve(n, P):
  max_val = 1
  count = 0
  for p in P:
    if max_val >= p:
      count += 1
    if max_val < p:
      max_val = p
  return count

_n = int(input())
_P = list(map(int, input().split()))
print(solve(_n, _P))
n = int(input())
p = [int(i) for i in input().split(' ')]

prei = 0
count = 0

for i in p:
  if i < prei:
    prei = i
    count += 1
  else:
    break
print(count)
max = 0
cnt = 0
N = int(input())
P = list(map(int, input().split()))

for i in range(N):
	p = P[i]
	if max < p:
		max = p
		cnt += 1
print(cnt)
n,*p=map(int,open(0).read().split())
c=1
for i in range(1,n):
    if p[i]<=p[i-1]:
        c+=1
print(c)
N = int(input())
P = tuple(map(int, input().split()))
cnt = N
for a in P:
    for b in P[:P.index(a)+1]:
        if a > b:
            cnt=-1
            break
print(cnt)
n=input()
p=input()
p=p.split()
q=[]
for i in range(len(p)):
    if min(p[0:i+1])==p[i]:
        q.append(p[i])
print(len(q))
n = int(input())
p = list(map(int, input().split( )))
c = 1
m = p[0]
for i in range(1, n - 1):
    if m - p[i] > 0:
        c += 1
    m = max(m, p[i])
print(c)
N = int(input())
Plist = list(map(int, input().split()))
now = Plist[0]
ans = 0
for p in Plist:
    if p <= now:
        ans += 1

    now = p
print(ans)
N = int(input())
lis = list(map(int, input().split()))

counter=0
minimum = 10
for i in range(N):
    minimum = min([minimum] + [lis[i]])
    counter += int(lis[i] <= minimum)
print(counter )
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input())

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

l = []

for i in range(n):
    l.append([i+1, p[i]])

l.sort(key = lambda x : -1*x[1])

ans = 0

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

print(ans)
import sys
from io import StringIO

def resolve():
    N = int(input())
    P = list(map(int, input().split()))
    m = (2 + 10^5) + 1;
    cnt = 0;
    for p in P:
        if(p <= m) :
            cnt = cnt + 1
        m = min(m, p)

    print(cnt)

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

newP = []
newP.append(P[0])
for i in range(1, N):
    if P[i-1] <= P[i]:
        newP.append(P[i-1])
    else:
        newP.append(P[i])
cnt = 0
for i in range(N):
    if newP[i] == P[i]:
        cnt += 1
    

print(cnt)
N=int(input())
P = list(map(int,input().split()))
ans=0
m=10*10
 
for i in P:
  if m>=i:
    ans+=1
    m=i
print(ans)
n  = int(input())
a = list(map(int, input().split()))

count = 0
m = a[0]
for i in range(1, n):
    if a[i]  <= m:
        m = a[i]
        count += 1
print(count)
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(n):
    s = p[0:i]
    if not s:
        continue
    if p[i] > p[i-1]:
        miss += 1
        continue
    if max < p[i]:
        max = p[i]
    if p[i] > max:
        miss += 1
        continue

    #s = sorted(s,reverse=True)
    #for j in range(i):
    #    if p[i] > s[j]:
    #        miss += 1
    #        break

print(n-miss)
import sys
import bisect
input = sys.stdin.readline

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

dp = [P[0]]
for i, x in enumerate(P):
	if x > dp[-1]:
		dp.append(x)
	else:
		dp[bisect.bisect_left(dp, x)] = x

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

memo = [0] * N
memo[0] = 1
minn = 0
for i in range(1, N):
    if P[i] <= minn:
        memo[i] = 1
    else:
        memo[i] = 0
    minn = min(minn, P[i])
print(sum(memo))
n = int(input())
m =list(map(int,input().split()))
ans = 0
if len(m) ==1:
    print(1)
else:
    for i in range(len(m)-1):
        s = m[0:i+1]
        print(max(s))
        if m[i] == min(s):
            ans+=1

    print(ans)
n = input()
p = list(map(int, input().split( )))
c = 1
m = p[0]
for a in p[1:]:
    if m - a > 0:
        c += 1
    m = max(m, a)
print(c)
N=int(input())
List=list(map(int,input().split()))
num=1

for i in range(N-1):
  if List[i]>=List[i+1]:
    num = num + 1
  else:
    break

print(num)
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,n):
    if p[i] > p[i-1]:
        miss += 1
        continue
    if max < p[i]:
        max = p[i]
    if p[i] > max:
        max = p[i] + 1
        miss += 1
        continue

print(n-miss)
N = int(input())
L = list(map(int, input().split()))

tmp = -1
count = 0
for i in range(N):
    if tmp <= L[i]:
        count += 1
    tmp = max(tmp, L[i])
        
print(count)
N = int(input())
P = input().split(" ")

count = 1

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

print(count)
x=int(input())
y=list(range(x))
y=list(map(int,input().split()))
c=0
while x>1:
  z=y[0:x]
  x=z.index(min(z))
  c+=1
print(c)
n=int(input())
p=list(map(int,input().split()))
a=0
b=10**10
for i in range(n):
	if p[i] <= b:
		a+=1
		b=a
	else:
		pass
print(a+1)
N = input()
P = input().split(' ')
count = 0
PM = min(P)
for i, Pi in enumerate(P):
    
    if i == 0:
        count = count +1
        Pmin = Pi
    elif Pi == PM:
        count = count +1
        break
    elif Pmin< P[i]:
        pass
    else:
        count = count +1
        Pmin = Pi

print(count)
input_list=[input() for i in range(2)]
N = int(input_list[0])
P_s = list(map(int,input_list[1].split()))	
output_s = 0
for i in range(N):
    output_num = 0
    for j in range(i+1):
        print(i, j)
        if P_s[i] > P_s[j]:
            output_num += 1
            break
    if output_num <= 0:
        output_s += 1

print(output_s)
n = input()
l = input().split()
m = 0
for i,li in enumerate(l,1):
    m += li <= min(l[:i])
print(m)
n=int(input())
p=input().split()
cnt=1
max1=p[0]
max2=p[0]
for i in p:

  if max1<i:
    max1=i
  if max2>i:
    cnt=cnt+1
    max2=i     
print(cnt)
N = int(input())
P  =  [int(x) for x in input().split()]
j = 0
count = 0

if len(P) <= N:
    for num in P:
        try:
            j = j + 1
            i = num - P[j]
            if i < 0 and count <= num:
                count = count + 1
        except:
           count = count + 1

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

S = 0
B = P[0]
cnt = 1
for i in range(1, N):
    S += P[i] - B
    if S < 0 and P[i] - B < 0:
        cnt += 1
    B = P[i]

print(cnt)
n=int(input())
x=list(map(int,input().split()))

count=1
for i in range(n-1):
  if x[i]>=x[i+1]:
    count=count+1
print(count)
N = int(input())
li = list(map(int,input().split()))

counter = 0

for i in range(0,N):
    if li[i]>li[i-1]:
        counter += 1
    else:
        pass
print(counter)
N = input()
P = [int(i) for i in input().split()]
count =0
flag = False
for i in range(len(P)):
    if P[i] <= P[0]:
        count+=1
    else:
        flag = True

if flag == True:
    count -=1

print(count)
def lowElements(n:int , array:list):
    count = 1
    for k in range(1,len(array)):
        if min(array[:k]) >= array[k]:
            count = count + 1
    return count
N=int(input())
P = list(input().split())

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

count = 0

for i in range(N):
    test = list(set(P))
    if P[N-1-i] == test[0]:
        count += 1
        del P[N-1-i]
    else:
        del P[N-1-i]

print(count)
N = int(input())
P = input().split()
counter = 0
m = N
for p in P:
    if int(m) > int(p):
        counter +=1
        m = p
print(counter)
n = int(input())
p = list(map(lambda x: int(x), input().split()))
mins = p[0]
def function(p, i, mins):
  if mins >= p[i]:
    mins = p[i]
    return 1
  else:
    return 0
sums = sum([function(p,i, mins) for i in range(n)])
print(sums)
n=int(input())
a=list(map(int,input().split()))
if a[0]==1:
  print(1)
else:
  print(n-a[0]+1)
import sys
import math
import itertools
N=int(input())
P=list(map(int,input().split()))
mn=10^6
cnt=1
for i in range(1,N):
    if P[i]<=mn:
        mn=P[i]
        cnt+=1
print(cnt)
N=int(input())
List=list(map(int,input().split()))

res=1
for x in range(0, N):
  if x+1<N and List[x]>List[x+1]:
    res+=1
  else:
    continue 
print(res)
N = int(input())
A = list(map(int , input().split()))
count = 0
for i in (reversed(range(1,N))):
    if A[i] <= A[i-1]:
        count+=1
print(count+1)
n=map(int,input().split())
*p,=map(int,input().split())

lmin=0
ans=0

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

print(ans)
n = int(input())
p_list = list(map(int, input().split()))
flg = 0
i_sum = 0
for i in range(1, n):
    for j in range(1, i+1):
        if p_list[j] >= p_list[i]:
            flg += 1
            if flg == i:
                i_sum += 1
                flg = 0
                continue
        else:
            flg = 0
            continue
        
print(i_sum +1)
n = int(input())
P = list(map(int,input().split()))
ans=0

for i in range(n-1):
  Q = (P[:i+1])
  if max(Q)!=P[i]:
        ans+=1
  if max(Q)==P[i]:
        ans+=0

print(ans+1)
N = int(input())
P = list(map(int,input().split()))
ans = 1
small = N
for i in range(1,N):
  if P[i] <= small: 
    ans += 1
    small = P[i]
print(ans)
import numpy as np

n = int(input())
p = np.array(input().split(), dtype = int)

num = 0
las = 0

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

print(num)
N = int(input())
P = input().split()
P = [int(p) for p in P]

ans = N
min_p = P[0]
for p in P[1:N]:
  if min_p > p:
    min_P = p
  else:
    ans -=1
  
  
print(ans)
n = int(input())
l = list(map(int, input().split()))

m = 2 * 10**5
ans = 0

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

print(ans)
N = int(input())

INF = 99999999

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

mins = [INF] * N

ans = 1
mins[0] = P[0]

for i in range(1,N):

    if (mins[i-1] > P[i]):
        ans += 1
        mins[i] = P[i]
#        print("i:" + str(i));
#        print(mins);
    else:
        mins[i] = mins[i-1]
n=int(input())
p=list(map(int,input().split()))
cnt=1
for i in range(1,n):
	if p[i-1]>p[i]:
		cnt+=1
print(cnt)
n = int(input())
p = input().split()

j = p[0]
count = 0
for i in range(n):
    if p[i] <= j:
        count += 1
        j = p[i]
print(count)
n=input()
p=input()
p=p.split()
q=[]
for i in range(int(n)):
    j=int(min(p[:i+1]))
    if j==int(p[i]):
        q.append(p[i])
print(len(q))
n = int(input())
x = list(map(int, input().strip().split(' ')))
count = 1
val = x[0]
if(len(x)==1): print(1)
else:
  for i in range(1,n-1):
    if(x[i]<val):
      count+=1
      val = x[i]
print(count)
n = int(input())
p = list(map(int,input().split()))
min = p[0]
c = 0
 
for smp in p:
  if(min > smp):
    min = smp
  else:
    c += 1
 
print(c)
N = int(input())
P = list(map(int, input().split()))

INF = 100100100
newP = [INF]*N
newP[0] = P[0]
for i in range(1, N):
    if P[i-1] <= P[i]:
        newP[i] = P[i-1]
    else:
        newP[i]  = P[i]
cnt = 0
for i in range(N):
    if newP[i] >= P[i]:
        cnt += 1
    

print(cnt)
n = int(input())
pn = list(map(int, list(input().split())))
count = 0

for i in range(n-1):
  for j in range(i):
    if pn[i] <= pn[j]:
      count += 1
      break
      
print(count)
n = int(input())
p_lst = list(map(int,input().split()))
number = 1

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

print(number)
n=int(input())
x=list(map(int,input().split()))


min_i = [x[0]]

for i in range(1,n):
    min_i.append(min(min_i[i-1],x[i]))

count=0
for i in range(1,n-1):
    if min_i[i-1] < x[i]:
        count=count+1
#  if x[i-1]>=x[i]:
#    count=count+1
    
#if min(x)==x[n-1]:
#  count=count+1
print(n-count)
N = int(input())
P  =  [int(x) for x in input().split()]
j = 0
count = 0

if len(P) <= N:
    for i in P:
        if i <= N:
            try:
                j = j + 1
                i = i - P[j]
                if i > 0:
                    count = count + 1
            except:
                count = count + 1

print(count)
n = int(input())
p = input().split()
now_min = p[0]
ans = 0
for i in range(n):
  if p[i] <= str(now_min):
    now_min = p[i]
    ans +=1
print(ans)
import itertools

N=int(input())
P=[i for i in range(1,N+1) if i%10 != 0]

P_ite=tuple(itertools.combinations_with_replacement(P, 2))
P_ite_len=len(P_ite)

ans=0
for i in range(P_ite_len):
    a=str(P_ite[i][0])
    b=str(P_ite[i][1])
    if a[0] == b[-1] and a[-1] == b[0]:
        if a == b:
            ans+=1
        else:
            ans+=2
print(ans)
N = int(input())
Pn = list(map(int, input().split()))

p_min = Pn[0]
cnt = 0
for i in Pn:
    if i <=p_min:
        cnt += 1
    p_min = min(p_min, i)
N = int(input())
P = list(map(int, input().split()))
c = 1
for i in range(N-1):
    if P[i] >= P[i + 1]:
        c += 1
print(c)
N = int(input())
P = list(map(int, input().split()))

cnt = 0
Flg = True
for i in range(N):
    for j in range(i+1):
        if P[j] < P[i]:
            Flg = False
            break
    if Flg:
        cnt += 1
print(cnt)
n = input()
p = input().split()

cnt = int(n)

for i in range(int(n)):
    if i != 0:
        for j in range(i):
            if p[i] > p[j]:
                cnt = cnt - 1
                break

print(cnt)
# -*- coding: utf-8 -*-

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

ans = 0
mi = 2*(10**5)
for p in pl:
	if p<mi:
		ans += 1
	mi = min(mi, p)
print(ans)
N = int(input())
P = map(int, input().split())
prev = 2 * 10 ** 5 + 1
ans = 0

for p in P:
    if p <= prev:
        ans += 1
    prev = p

print(ans)
n = int(input())
p = list(map(int,input().split()))
count = 1
for i in range(n - 1):
  if p[i] >= p[i + 1]:
    count += 1
  else:
    count += 0
print(count)
import queue
import copy
import math
from collections import deque

# そのまま入力文字列の入力
n = int(input())

# 空白区切りの数値をリスト化
pn = list(map(int, input().split()))

ans = 0
for i in range(0, n):
    if i == 0:
        ans += 1
        continue

    if pn[i-1] >= pn[i]:
        ans += 1
        continue

print(ans)
n = int(input())
p = [int(i) for i in input().split()]
c = 0
for i, pi in enumerate(p):
    if pi > p[i-1]:
        continue
    if pi == min(p[:i+1]):
        c += 1
print(c+1)
N = int(input())
p = list(map(int, input().split()))
ans = 1
for i in range(1,N):
    if p[i-1]>p[i]:
        ans +=1
print(ans)
N=int(input())
P=list(map(int,input().split()))
ans=0
c=0
for i in range(N):
  for j in range(i):
    if P[i]<=P[j]:
      c=c+1
  if c==i:
    ans=ans+1
print(ans)
n = int(input())
p_li = [int(w) for w in input().split()]

ans = 0
used_min = 200000

for i in range(n):
    if p_li[i] < used_min:
        ans += 1
        used_min = p_li[i]
print(ans)
N = int(input())
P = list(map(int, input().split()))
ans = 0
min_num = P[0]
for n in P:
    if n < min_num:
        min_num = n
        ans += 1
print(ans)
n = int(input())
p = list(map(int, input().split()))

l = []
l.append(p[0])
c = 200000
for i in range(0, n-1):
  if p[i+1] < p[i]:
    l.append(p[i+1])
    
print(len(l))
N=int(input())
P=list(map(int, input().split()))
 
cnt=1
 
if N==1:
    print(1)
elif N==2:
    if P[1] < P[0]:
        print(2)
    else:
        print(1)
else:
    tmp = P[0]
    for i in range(2,N):
        if P[i] < min(P[i-1],tmp):
            tmp = min(P[i-1],tmp)
            cnt+=1
    print(cnt)
'''
n = int(input())
seq = [int(e) for e in input().split(' ')]

count = 0
for i in seq:
  number_loop = len(seq[0:seq.index(i)+1])
  for idx, j in enumerate(seq[0:seq.index(i)+1]):
    if i > j:
      break
    if idx+1 == number_loop:
      count += 1
      
print(count)
'''

n = int(input())
seq = [int(e) for e in input().split(' ')]

count = 1

for idx, i in enumerate(seq[1:]):
  if i > idx+2:
   continue
  else:
    count += 1
print(count)
n=int(input())
x=list(map(int,input().split()))

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

MIN = 10*10
ans = []

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

c = [0] * n

if (p[0] == n):
    print(n)
else:
    for i in range(n):
        if (i == 0):
            c[i] = 0
        elif (p[i-1] < p[i]):
            c[i] = 1
    if (p[n-1] == n):
        print(c.count(0)+1)
    else: print(c.count(0))
N = int(input())
P = input().split()
j=1
count = 0

if(len(P) == N):
    for i in P:
        if j<len(P):
            if int(i) > int(P[j]) and int(i) >= 1 and int(i) <= 2000000:
                count+=1
                j+=1
            else:
                j+=1
        else:
            if int(i) > 0:
                count+=1
    print(count)
N=int(input())
PN=input().split()
PN=list(map(int,PN))

res=1
for i in range(N-1):
  if PN[i]>=PN[i+1]:
    res+=1
print(res)
n=int(input())
P=list(map(int,input().split()))
s=0
for i in range(n):
  x=P[i]
  flag=True
  for j in range(i):
    if P[j]>x:
      flag=False
      break
  if flag:
    s+=1
print(s)
N = int(input())
P = list(map(int,input().split()))

#任意の整数 j(1≤j≤i)に対して、 Pi≤Pj をみたすiの個数
maximum = 0
counter = 0
for i in range(N):
    if P[i]>maximum:
        maximum = P[i]
    else:
        counter += 1

print(counter)
num = int(input())
p = map(int, input().split())
pList = list(p)
ret = 0

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

print("{}".format(ret))
n = int(input())
lis = list(map(int, input().split()))
 
for i in range(n):
    for j in range(i):
        if lis[i] > lis[j]:
            n -= 1
        break
print(n)
n = int(input())
p = list(map(int, input().split()))

def code(n,p):
    flg = 1

    for idx in range(1,n):
        if min(p[0:idx]) >= p[idx]:
            flg+=1
            print(p[idx])
    return flg

idx = code(n,p)
if idx == None:
    print(n)
else:
    print(idx)
n=int(input())
plis=list(map(int,input().split()))
m=plis[0]
p=n
ctr=0
for i in range(1,m+1):
    if i in plis[:p]:
        ctr+=1
    p=plis.index(i)
print(ctr)
N = int(input())
lst = list(map(int,input().split()))

cnt = 1
m = lst[0]

for i in lst:
  if i <= m:
    cnt +=1
    m = i
print(cnt)
n=int(input())
l=list(map(int,input().split()))
c=0
for i in range(n-1):
    if l[i]>=l[i+1]:
        c+=1
print(c+1)
N = int(input())
P = list(map(int, input().split()))
Cor = 0

PreNum = N
for NextNum in P:
    if PreNum >= NextNum:
        PreNum = NextNum
        Cor = Cor + 1
    else:
        PreNum = NextNum

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

min = 2*(10**5)
cnt = 0

for i in range(n):
  if p[i] < min:
    min = p[i]
    cnt += 1
print(cnt)
N=int(input())
P=list(map(int,input().split()))
ans=1
for i in range(N-1):
  if P[i]>P[i+1]:
    ans+=1
print(ans)
n = int(input())
p_lst = list(map(int,input().split()))
number = 1

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

print(number)
n=int(input())
a=map(int,input().split())
ans=0
c=10**5+1
for i in a:
    c=min(i,c)
    if c==i:
        ans+=1
print(ans)
n=int(input())
arr=list(map(int,input().split()))
total=1
if len(arr)==1:
  total=1
else:
  for i in range(0,n-1):
    if arr[i]>arr[i+1]:
      total+=1
    else:
      continue
print(total)
n = int(input())
p = list(map(int,input().split()))

ans = 0

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

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

mins=[0]*n
mins[0]=p[0]
for i in range(1,n):
    mins[i] = min(p[i-1], p[i])

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

print(ans)
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in range(len(a)-1):
    for j in range(i+1,len(a)):
        if a[i] >= a[j]:
            ans += 1
            break
print(ans)
def main(length_num,num_list):
    count_num = 0
    for i in range(0,length_num):
        temp_list = num_list[0:i+1]
        temp_list.sort()
        if int(temp_list[0]) >= int(num_list[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))
N = int(input())
P = list(map(int, input().split()))

count = 0
i = 0

for num in range(N,0,-1):
#    print("i:%.f, P:%.f, num:%.f" %(i, P[i], num))
    if(P[i] <= num):
        count+=1
    else:
        pass
    i+=1


print(count)
n = int(input())
pn = list(map(int, input().split()))
ans = 1
for i in range(0,n-1):
  if pn[i] >= pn[i+1]:
    ans += 1
print(ans)
N = int(input())
Ps = list(map(int, input().split()))

memory = []

count = 0

for i in reversed(range(N)):
    if i in memory:
        continue
    for j in reversed(range(i + 1)):
        if Ps[i] > Ps[j]:
            memory.append(j)
            break
        if i == j:
            count+=1

print(count)
n=int(input())
p=input().split()
cnt=0
min=p[0]
for i in p:
  if i<=min:
    cnt=cnt+1
    min=i
print(cnt)
N = int(input())
P = list(map(int,input().split()))
flag = 0
count = 0
for i in range(N):
  for j in range(i):
    if P[i] > P[j]:
      flag += 1
  if flag == 0:
    count += 1
print(count)
n=int(input())
c=list(map(int,input().split()))
q=sorted(c)[::-1]
count=0
for i in range(len(c)):
  if c[i]<q[i]:
    count+=1
print(count)
a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]>v:
        k+=1
print(k)
n = int(input())
array = input().split()
count = 1
for k in range(1,len(array)):
    if min(array[:k]) >= array[k]:
        count = count + 1
print(count)
N=int(input())
P=[int(s) for s in input().split(" ")]

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

print(count)
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]
        else:
            m = P[i]
            c += 1
    print(c)
resolve()
n=int(input())
p=list(map(int,input().split()))
q=p
q.sort(reverse=True)
cnt=0
for i in range(1,n+1):
  del p[p.index(q[i-1]):]
  cnt+=1
  if len(p)==0:
    print(cnt)
    exit()
N = int(input())
P = list(input().split())

times = 0
for i in range(len(P)):
  safe = True
  for j in range(i+1):
    if not P[i] <= P[j]:
      safe = False
  if safe:
    times += 1
print(times)
N = int(input())
List=list(map(int,input().split()))
num = 0
cur = 0
for i in range(N):
  num = num + 1
  if cur > List[i]:
    cur = List[i]
  else:
    break
print(num)
n=int(input())
P=list(map(int,input().split()))
Q=[]
ans = 1
for i in range(1,n):
  Q.append(P[i])
  if P[i] == min(Q):
    ans += 1
print(ans)
N=int(input())
A=list(map(int,input().split()))

ans=1
for n in range(1,N):
  if A[n]<A[n-1]:
    ans+=1
print(ans)
import sys
import bisect
n = int(input())
p_ls = [int(i) for i in sys.stdin.readline().split()]
count = 0
p_ls.reverse()
ls = [10**18]
cnt = 0
_max = 0
for p in p_ls:
    ind = bisect.bisect_left(ls, p)
    if ind == len(ls):
        ls.append(p)
    else:
        ls[ind] = p
    _max = max(ind, _max)
print(_max + 1)
list_raw = [int(x) for x in input().split()]

list_parsed = []

count = 0
for elem in list_raw:

    list_parsed.append(elem)
    if max(list_parsed) >= elem:
        count += 1

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

cnt = 0
tmp = p[0]
for i in range(n):
    if tmp > p[i]:
        cnt += 1
        tmp = p[i]
print(cnt)
n=int(input())
l=list(map(int, input().split()))
ans=0
min=2*100000
for i in range(n):
    num_now=l[i]
    if num_now<min:
        ans+=1
        min=num_now
print(ans)
N=int(input())
P_list=input().split()
count=0
while P_list!=[]:
    minindex=P_list.index(min(P_list))
    P_list=P_list[0:minindex]
    count+=1
    
print(count)
N = int(input())
p = list(map(int, input().split()))

# 累積和を求める
s = [0]*(N)
s[0] = p[0]
for i in range(N-1):
  s[i+1] = s[i] + p[i+1]

ans = 1
for i in range(1, N):
  if s[i-1] > p[i]*i: ans += 1
    
print(ans)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input())

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

l = []

for i in range(n):
    l.append([n+1, p[i]])

l.sort(key = lambda x : x[1])

ans = 0

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

print(ans)