peterverebics/CodeNet_Python_118 huggingface dataset:
import bisect
n = int(input())
ARR = list(map(int,input().split()))
arr =ARR[::-1]

lis =[arr[0]]

for i in range(1,n):
     pos = bisect.bisect_right(lis,arr[i])
     if arr[i] >=lis[-1]:
          lis.append(arr[i])
     else:
          lis[pos]=arr[i]
print(len(lis))
n = int(input())
p = input().split()
c = n
for i in range(n):
    for w in p[:i]:
        if w < p[i]:
            c = c-1
            break
print(c)
n=int(input())
lists=list(map(int,input().split()))

mn=2*10^5+1
cnt=0
for li in lists:
  if mn>li:
    mn=li
    cnt+=1
print(cnt)
n = int(input())
q = list(map(int, input().split(" ")))

result = 0
flg = True
temp = 10

for i, item in enumerate(q):
  if temp > item:
    for j in q[:i+1]:
      if j < item:
        flg = False
        temp = item
        break
      flg = True
  else:
    flg = False

  if flg:
    result = result + 1

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

def code(n,p):
  answer = 0
  for idx, pp in enumerate(p):
    if pp>n:
      answer = idx+1
      
  return idx

idx = code(n,p)
if idx == None:
  print(n)
else:
  print(idx)
N = input()
N = [int(s) for s in N]
input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

count = 0
for x in range(N[0]):
    # print("x",x)
    flag = 1
    for i in range(x+1):
        # print("i",i)
        if Line[x] > Line[i] :
            # print(Line[x],Line[i])
            flag = 0
    # print("ss")
    if flag == 1 :
        # print("OK")
        count += 1

print(count)
n,*p=map(int,open(0).read().split())
cnt=0
for i in range(n-1):
  if p[i]<p[i+1]:
    cnt+=1
print(n-cnt)
import sys
input = sys.stdin.readline

n, s, c = int(input()), list(map(int, input().split())), 1
for i in range(n - 1):
	if s[i] >= s[i+1]: c += 1
print(c)
N = int(input())
P = list(map(int, input().split()))
n = N
for i in range(1,N):
  if P[i] != min(P[0:i+1]):
    print(P[0:i+1])
    print(P[i])
    n -= 1
  else:
    pass
print(n)
from bisect import bisect

N, *P = map(int, open(0).read().split())

INF = 10 ** 6
dp = [INF] * (N + 1)
for i in range(N):
    dp[bisect(dp, -P[i])] = -P[i]
    
print(sum(dp[i] < INF for i in range(N)))
N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N):
    for j in range(i+1):
        if P[i] > P[j]:
            break
        count += 1
print(count)
n = int(input())
p = list(map(int, input().split()))

mx = 0
ans = 0
for e in p:
    mx = max(mx, e)
    if e >= mx:
        ans += 1

print(ans)
import itertools

N = int(input())
li = input().split()
tmp = int(li.pop(0))
tmp = len(list(itertools.permutations(range(N), tmp)))
res = list()
res.append(tmp)
m = min(res)
for item in li:
  item = int(item)
  tmp = len(list(itertools.permutations(range(N), item)))
  if tmp <= m:
    res.append(tmp)
  m = min(res)

print(len(res))
print(res)
n=int(input())
num=[]
a=input().split(" ")
ans=[]
for i in range(n):
    num.append(int(a[i]))
for i in range(n):
    count=0
    if i==0:
        ans.append(a[i])
    else:
        for j in range(0,i):
            if a[i]>a[j]:
                count+=1
                break
        if count==0:
            ans.append(a[i])
print(len(ans))
def main():
    import sys
    N = int(input())
    input_2 = sys.stdin.readline
    P_list = list(input_2().split())
    i_num = 0
    for i in range(N):
        if P_list[i] <= min(P_list[:i+1]):
            i_num += 1
    print(i_num)

if __name__ == "__main__":
    main()
N=int(input())
P=list(map(int,input().split()))
M=0
c=0
for i in range(N):
  if M<P[i]:
    M=P[i]
    c+=1
print(c)
N = int(input())
P = [int(i) for i in input().split()]
num = 1

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

count = 1

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

print (count)
N = input()
N = [int(s) for s in N]
input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

count = 0
for x in range(N[0]):
    # print(x)
    flag = 1
    for i in range(x+1):
        # print(i)
        if Line[x] > Line[i]:
            # print(Line[x],Line[i])
            flag = 0
    # print("ss")
    if flag == 1 :
        count += 1

print(count)
N = input()
N = [int(s) for s in N]
input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

count = 0
for x in range(N[0]):
    print("x",x)
    flag = 1
    for i in range(x+1):
        print("i",i)
        if Line[x] > Line[i] :
            print(Line[x],Line[i])
            flag = 0
    print("ss")
    if flag == 1 :
        print("OK")
        count += 1

print(count)
class MyList(list):
    def last_index(self):
        return len(self)-1

N = int(input())
P = MyList(map(int, input().split()))
temp = P.last_index()
j=1
count = 0

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

count = 0 # p_j > p_i である回数
for i in range(len(p_list)):
    flag = True
    for j in  p_list[:i+1:-1]:
        if i>j:
            flag = False
            break
    if flag:
        count = count + 1

print(count)
N = input()
P = input().split(' ')

for i, Pi in enumerate(P):
    if i == 0:
        count = 1
    elif Pi<= min(P[0:i]):
        count = count +1
print(count)
n = int(input())
p = list(map(lambda x: int(x), input().split()))
mins = p[0]
def function(p, i, mins):
  if mins >= p[i]:
    return 1
  else:
    mins = p[i]
    return 0
sums = sum([function(p,i, mins) for i in range(1, n)])
print(sums)
n = int(input())
lis = list(map(int, input().split()))
b = 0
for i in range(n):
    a = 0
    for j in range(n-1):
        if lis[i] < lis[j]:
            a += 1
        if a == i -1:
            b += 1
print(b)
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


N=input1()
p=input_array()
count=0
for i in p:
	flag=True
	for j in p[:i+1]:
		if i<=j:
			flag=True
		else:
			flag=False
			break
	if flag:
		count+=1
print(count)
a=int(input())
p=list(map(int,input().split()))
k=1
for i in range(a-1):
    if p[i+1]<p[i]:
        k+=1
print(k)
n=int(input())
p=list(map(int,input().split()))
minnumber=100001
count=0

for i in p:
  if i<=minnumber:
    count+=1
    minnumber=i
    
print(count)
N = int(input())
Plist = list(map(int, input().split()))
now = Plist[0]
ans = 0
for p in Plist:
    if p <= now:
        ans += 1
    else:
        break
    now = p
print(ans)
n = int(input())
a = list(map(int,input().split()))

mx = 0
ans = 0
for i in a:
    if i<=mx:
        ans+=1
    mx = max(mx,i)
print(ans)
N = int(input())
num_list = [int(i) for i in input().split()]

counter = {"check": 1}
for i in range(1,N):

    count = len([j for j in range(0,i) if num_list[i] <= num_list[j]])
    if count != 0:
        counter["check"] += 1

print(counter["check"])
n = int(input())
p = list(map(int,input().split()))

counter = 0


for i in range(n):
    min = p[i]

    for j in range(0,i):
        print("hogeb:"+str(p[j])+"&"+ str(p[i]))
        if min >= p[j]:
            min = p[j]

    if min == p[i]:
        counter += 1

print(str(counter))
list=list(map(int, input().split()))
count=0
m=list[0]
for i in list:
    a=i
    if m >= a:
        count+=1
    m = a
print(count)
n=int(input())
li = list(map(int,input().split()))
Q=0
for i in range(n-1):
  if li[i]<li[i+1]:
    Q+=1
print(n-Q)
from sys import stdin
def main():
    N=int(stdin.readline().strip())
    A=[int(x) for x in stdin.readline().split()]
    j=0
    ans=0
    for i in range(1,len(A)):
        if A[j]>=A[i]:
            j+=1
        else:
            break
        ans=i+1
    print(min(ans+1,N))
main()
n = int(input())
pn = list(map(int, input().split()))


ans = 1
if n > 1:
    count = 0
    for i in range(1,n):
        count += 1 if pn[i-1] > pn[i] else 0

    ans += count

print(ans)
n = input()
p = input().split()
cnt = 0
cn = 0
fm = False

for i in range(len(p)):
	cn = int(p[i])
	if fm and i > 0 and p[i] < p[i-1] :
		cnt += 1
		continue
	for j in range(i + 1):
		if cn > int(p[j]):
			fm = False
			break
		if i == j:
			cnt += 1
			fm = True

print(cnt)
N=int(input())
List=list(map(int,input().split()))

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

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

print(answer)
N = input()
lis = input().split(" ")
cnt = 1
i = 0
for i in range(int(N)):
    for j in range(i-1,-1,-1):
        if int(lis[i])>int(lis[j]):
            break
        else:
            cnt +=1
        break
print(cnt)
n=int(input())
plist=list(map(int,input().split()))

a=max(plist)
cnt=0

for p in plist:
    if p == plist[0]:
        a = p
        cnt +=1
    else:
        if p <= a:
            a = p
            cnt += 1

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

mini = 100000
cnt = 0
for i in range(n):
    mini = min(p[i], mini)
    if p[i] == mini:
        cnt+=1

print(cnt)
import numpy as np
from collections import Counter

# 最頻値
def mode(list):
    c = Counter(list)
    freq_scores = c.most_common()
    max_count = freq_scores[0][1]
    modes = []
    for num in freq_scores:
        if num[1] == max_count:
            modes.append(num[0])
    return(modes)

n = int(input())
p_list = list(map(int, input().split()))
ans = 1
for i in range(n - 1):
  if p_list[i] >= p_list[i + 1]:
    ans += 1
print(ans)
n = int(input())
p = list(map(int,input().split()))
miss = 0
max = p[0]
for i in range(1,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)
n,*p=map(int,open(0).read().split())
cnt=0
for i in range(1,n)[::-1]:
  if p[i-1]<p[i]:
    cnt+=1
print(n-cnt)
N = int(input())
P = [int(i) for i in input().split()]
num = 1

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

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

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

counter = 0
li2 =[]
for i in range(N):
    if li[i]>li[i-1]:
        li2.append(1)
    elif N == 1:
        li2.append(1)
print(len(li2))
n = input()
p = input().split()
cnt = 1

for i in range(1, len(p)):
	if p[i-1] > p[i]:
		cnt += 1
	if p[i] == 1:
		break

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

for i in range(1, N):
  isbreak = False
  for j in range(0,i):
    print(P[i])
    print(P[j])
    if (P[i] > P[j]):
      isbreak = True
      break
  if isbreak == False:
    count += 1
    
print(count)
n = int(input())
p = [int(x) for x in input().split()]

min_p = 1000000000000

count = 0
 
for i in p:
    # 最小値更新
    print(i)
    if (min_p >= i):
        min_p = i
    if (min_p >= i):
        count += 1

print(count)
import resource

resource.setrlimit(
    resource.RLIMIT_DATA,
    (1024 * 1024 ** 2, -1))

n = int(input())
s = input().split()

min_s = s[0]
count = 0

for num in s:
  if min_s >= num:
    count += 1
    if min_s > num:
      min_s = num

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

ll = []
ll.append(l[0])

for i in range(len(l)-1):
  if ll[i] > l[i+1]:
    ll.append(l[i+1])
  else:
    ll.append(l[i])

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

count = 0
for i in range(n):
  if i == 0:
    count+=1
  elif p[i - 1] > p[i]:
    count+=1
print(count)
import sys
input = sys.stdin.readline
n = int(input())
p = list(map(int, input().split())) 

ans = 1
flag = True

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

print(ans)
N = int(input())
m = [0]*N
s = input()
m = s.split()
c = 99999999
k = 0
for i in range(N):
	m[i] = int(m[i])
	if m[i] > c:
		c = m[i]
		k +=1

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

for i in range(1, n):
    for j in range(n):
        if p[i] > p[j]:
            count -= 1
            break
            
print(count)
# -*- 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 = list(map(int,input().split()))
up = down = 0

for i in range(N-1):
    if P[i]>P[i+1]:
        down += 1
    elif P[i]<P[i+1]:
        up += 1


if up>down:
    down += 1
else:
    up += 1

if up==N-1:
    print(1)
elif up==N-1:
    print(N)
else:print(max(up,down))
N=int(input())
P=list(map(int,input().split()))
ans=[1]*N
flag=0
for i in range(1,N):
    for j in range(i):
        if P[i]>P[j]:
            flag=1
            break
    if flag==1:
        ans[i]=0
print(sum(ans))
n = int(input())
P = list(map(int,input().split()))
ans=0

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

print(ans+1)
import sys
input = sys.stdin.readline

n, s, c, m = int(input()), list(map(int, input().split())), 0, -1
for i in range(n):
	if s[i] <= m: m = s[i]; c += 1
print(c)
N = int(input())
P = list(map(int, input().split()))
cnt = 0
L = sorted(P, reverse=True)
Q = sorted(P)
if P == L:
    cnt = len(P)
elif P == Q:
    cnt += 1
else:
    for n in range(N):
        if P[n] < L[n]:
            cnt += 1
print(cnt)
N = int(input())
P = list(map(int, input().split()))

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

print(cnt)
N = int(input())
lis = list(map(int, input().split()))
#haha = [min(lis[:i+1]) for i in range(N)]
sum(list(map(lambda x: x <= 0, [lis[i] - min(lis[:i+1]) for i in range(N)])))
N = int(input())
P = input().split(" ")

count = 1

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

print (count)
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
print(count)
import heapq
n = int(input())
p = list(map(int,input().split()))

h = []
heapq.heapify(h)
ans=0
for i in range(len(p)):
    heapq.heappush(h,p[i])
    m = heapq.heappop(h)
    if m==p[i]:
        ans+=1
        heapq.heappush(h,m)
print(ans)
n = int(input())
P = list(map(int, input().split()))
t = 0
m = P[0]
for i in range(1, n):
  if m > P[i]:
    m = P[i]
    t += 1
print(t)
n = int(input())
p = list(map(int, input().split()))

ans = 0
max_val = 0

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

ans = 0
for i in range(n):
    for j in range(i+1):
        if (p[i] <= p[j]):
            ans += 1
            break
print(ans)
n = int(input())
p = list(map(int, input().split()))
num = 1
for i in range(n-1):
    if p[i+1] < p[i]:
        num += 1
print(num)
import numpy as np
N = int(input())
P_lis = np.array(list(map(int,input().split())))
 
count = 0
for i in range(N):
  lis = P_lis[0:i+1]
  lis = lis - lis[i]
  if -1 in np.sign(lis):
    count += 1
print(count)
n = int(input())
p = list(map(int, input().split()))

ans = 0
cnt = 1

flg = True

for i in range(n):
    for j in range(i):
        if p[i] <= p[j]:
            flg = True
        else:
            flg = False
    if flg:
        ans += 1

print(ans)
n=input()
p=input()
p=p.split()
q=[p[0]]
for i in range(int(n)):
    j=max(p[:i+1])
    if j>p[i]:
        q.append(p[i])
if p[int(n)-1]!=min(p):
    q.pop(-1)
print(q)
N = input()
P = input().split(' ')
count = 0
PM = min(P)
for i, Pi in enumerate(P):
    Pmin = Pi
    if i == 0:
        count = count +1
    elif Pi == PM:
        count = count +1
        break
    elif Pmin< P[i]:
        pass
    elif Pi<= Pmin:
        count = count +1
        Pmin = Pi
print(count)
#https://atcoder.jp/contests/abc152/tasks/abc152_c
# -*- coding: utf-8 -*-
N = int(input())
P = input().split()
T = [1]*N
for i in range(len(P)):
  P[i] = int(P[i])
for i in  range(1,len(P)):
  if P[i]>=P[i-1]:
    T[i] = 0
print(T.count(1))
n = int(input())
p = list(map(int, input().split()))

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

print(ans)
import numpy as np
n = int(input())
p = list(map(int, input().split()))
p_diff = np.diff(p)
cnt = 1
for x in p_diff:
  if(x <= 0):
    cnt += 1
print(cnt)
N = int(input())
P = list(map(int, input().split()))

dp = [0 for _ in range(N+1)]
for i in range(N):
    if dp[i] <= P[i]:
        dp[i+1] = P[i]
    else:
        dp[i+1] = dp[i]

cur = 0
prev = dp[0]
ans = 0
for i in range(N+1):
    if prev == dp[i]:
        cur += 1
        ans = max(ans, cur)
    else:
        ans = max(ans, cur)
        cur = 1
    prev = dp[i]

print(ans)
N = input("")
L = input("").split(" ")
suc = N

def fun(num,s):
    suc = int(s)
    for j in range(num):
        if (L[j] < L[num]):
            suc -= 1
            break
    
    return suc
        

for i in range(int(N)):
    suc = fun(i,suc)
    
print(suc)
n = int(input())
p = list(map(int,input().split()))
miss = 0
for i in range(n):
    s = p[0:i]
    if not s:
        continue
    if p[i] > max(s):
        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 numpy as np
n=int(input())
pl=np.array(list(map(int, input().split())))

r_pl = np.roll(pl, 1)
r_pl[0] = len(pl)+1
d_pl = pl*(pl -r_pl)
print(len(d_pl[d_pl < 0]))
N=int(input())
L=list(map(int,input().split()))
ans=0
prev=-1
for l in L:
  if l<prev:
    ans+=1
    prev=l
  else:
    continue
print(ans)
n = int(input());
p = input().split(' ');

for i in range(n) :
	p[i] = int(p[i]);

dp = [0]*n;
flg = [1]*n;
comp = n+1;

for i in range(1,n) :
	if p[i-1] < p[i] :
		comp = p[i-1];
	if p[i] > comp :
		flg[i] = 0;

print(sum(flg));
n = int(input())
p = list(input('').split())
print(p)

count = 0
count2 = 0
for i in range(1,n):
    count = 0
    for j in range(i):
        if int(p[j]) >= int(p[i]):
            count += 1
    if count == i:
        count2 += 1

print(count2 + 1)
N = int(input())
P = [int(x) for x in input().split()]
cnt=1
tmp=P[0]
for i in range(1, N):
    if min(tmp, P[i-1]) >= P[i]:
        cnt+=1
#         print(i, cnt)
        
print(cnt)
from bisect import bisect_right
N = int(input())
P = list(map(int, input().split()))
res = []
for p in P[::-1]:
    idx = bisect_right(res, p)
    if idx == len(res):
        res.append(p)
    res[idx] = p
print(len(res))
if __name__ == "__main__":
    N = int(input())
    P = input().split()
    cnt = 0
    for i in range(N):
        cnt = len([1 for x in P if x>=P[i]])
    print(cnt)
n=int(input())
l=list(map(int,input().split()))
c=1
b=l[0]
for p in l[1:]:
    if b>=p:
        c+=1
    b=p
print(c)
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left

sys.setrecursionlimit(10**7)
N = int(input())
P = list(map(int, input().split()))

rP = list(reversed(P))
seq = rP.copy()

LIS = [seq[0]]
for i in range(len(seq)):
    if seq[i] > LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect_left(LIS, seq[i])] = seq[i]

print(len(LIS))
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 21:01:18 2020

@author: over-
"""

N=int(input())
P=input().split()

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


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

a=0
cnt=0
for i in range(1,n):
    if a<p[i]:
        a=p[i]
        cnt+=1
print(n-cnt)
N = int(input())
P = list(map(int, input().split()))
cnt = 0
min_n = P[0]
for i in range(N):
    if min_n >= P[i]:
        cnt += 1
        min_p = P[i]
print(cnt)
N=int(input())
S=list(map(int,input().split()))
res=0

for i in range(N):
  tmp=S[0]
  for j in range(i):
    if tmp>S[j]:
      tmp=S[j]
  if tmp==S[i-1]:
    res+=1
      
print(res)
a= int(input())
b= input().split()
compare=b[0]
c=1

for i in range(a):
    if (compare>=b[i]):
        compare=b[i]
        c=c+1
        
print(c)
n = int(input())
a = list(map(int, input().split( )))
ans = 0
tmp = 0
for i in range(n):
    if tmp>=a[i]:
        tmp = a[i]
        ans += 1
    tmp = max(a[i],tmp)
print(ans)
import numpy as np

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

num = 0
cnt = 0

for i in range(len(P)):
    a = P - P[i]
    for j in range(i,len(P)):
        if a[j] <= 0:
            num += 1
            continue
            
    cnt += int(num/(len(P)-i))
    num = 0
        
            
print(cnt)
n = input()
p = input().split()
cnt = 1

for i in range(1, len(p)):
	if p[i-1] > p[i]:
		cnt += 1

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

ans = 0
b4 = -1000000000
for i in a:
    if(b4 < i):ans+=1
    b4=i
print(ans)
n = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(n):
  if p[i] <= p[i-1]:
    count += 1
print(count)
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    flag = True

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

if __name__ == "__main__":
    main()
import sys
input = sys.stdin.readline
import bisect
 
INF = 10 ** 11
N = int(input())
ARR = list(map(int,input().split()))
A =ARR[::-1]
 
dp = [INF] * (N+1) 
 
for a in A:
    idx = bisect.bisect_right(dp,a)
    dp[idx] = a
 
answer = bisect.bisect_left(dp, INF)
print(answer)
N = int(input())
P = list(map(int, input().split()))
cnt = 1
for i in range(1, N):
  if P[i] <= P[i - 1]:
    cnt += 1
print(cnt)
N = int(input())
P = list(map(int, input().split()))

ans = 0
min_v = -1
for i in range(0, N):
    if P[i] < min_v:
        ans += 1
        continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = P[i]

print (ans)
n = int(input())
p = list(map(int, input().split()))
cnt = 0
idx = p.index(1)
p = p[:idx+1]
seq = p[::-1]

import bisect

LIS = [seq[0]]
for i in range(len(seq)):
    if seq[i] > LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]

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

def code(n,p):
  for idx, pp in enumerate(p):
    if pp>n:
      return idx

idx = code(n,p)
print(idx)
n = int(input())
li = list(map(int,input().split()))

i = 0
j = 0
a = 10**6
for i in range(i,n-1):
  a = min(a,li[i])
  if a == li[i]:
    j = j + 1

print(j)
n=int(input())
l=list(map(int,input().split()))
ans=0
tmp=0
for i in range(1,n):
    if tmp<=l[i]:
      tmp=max(tmp,l[i])
      ans+=1
print(ans)
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
  else:
    min_v=p[i]

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

count = 0
for i in range(n):
  if i == 0:
    count+=1
  elif p[i - 1] >= p[i]:
    count+=1
print(count)
n = int(input())
p = [int(i) for i in input().split()]
count = 0
for i in range(n):
    if p[i] <= max(p[0:i]) if i != 0 else p[0]:
        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
    elif N == 1:
        counter += 1
print(counter)