Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
import random

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def query(i):
    print(i)
    sys.stdout.flush()
    s = in_s()
    if s == 'Vacant':
        exit(0)
    elif s == 'Male':
        return 0
    elif s == 'Female':
        return 1


def main():

    N = in_n()

    min_i = 0
    max_i = N

    fm = query(0)

    while True:
        now_i = (min_i + max_i) // 2
        now_fm = query(now_i)

        if (now_i - min_i) % 2 == 0:
            if now_fm == fm:
                min_i = now_i
            else:
                max_i = now_i
        elif (now_i - min_i) % 2 == 1:
            if now_fm == fm:
                max_i = now_i
            else:
                min_i = now_i

        fm = now_fm

        if max_i - min_i == 1:
            exit(0)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import random

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def query(i):
    print(i)
    sys.stdout.flush()
    s = in_s()

    if s == 'Vacant':
        exit(0)
    elif s == 'Male':
        return 0
    elif s == 'Female':
        return 1


def main():

    N = in_n()

    min_i = 0
    max_i = N

    min_fm = query(0)
    max_fm = min_fm

    while max_i - min_i != 1:
        now_i = (min_i + max_i) // 2
        now_fm = query(now_i)

        if abs(now_i - min_i) % 2 == 0 and now_fm != min_fm:
            max_i = now_i
            max_fm = now_fm
        elif abs(now_i - min_i) % 2 == 1 and now_fm == min_fm:
            max_i = now_i
            max_fm = now_fm
        elif abs(now_i - max_i) % 2 == 0 and now_fm != max_fm:
            min_i = now_i
            min_fm = now_fm
        elif abs(now_i - max_i) % 2 == 1 and now_fm == max_fm:
            min_i = now_i
            min_fm = now_fm


if __name__ == '__main__':
    main()
### BUGGY CODE ###

def get_answer(ki):
    n = ki[0][0]
    q = ki[0][1]
    #n_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[1:-q]]]
    #q_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[-q:]]]
    n_data = ki[1:-q]
    #q_data = ki[-q:]
    q_index = [0] * n
    for qq in ki[-q:]:
        q_index[qq[0] - 1] += qq[1]

    score = [0] * n

    """
        assert get_answer(["4 3",
                       "1 3", "1 4", "2 3",
                       "2 10", "1 100", "3 1"]) == "100 111 101 100"
    """
    t_index = {}
    for i in range(1, n + 1):
        t_index[i] = []
    for nn in n_data:
        t_index[nn[0]].append(nn[1])
        t_index[nn[1]].append(nn[0])


    """
    for qq in q_data:
        i = qq[0]
        if i in q_index.keys():
            q_index[i] += qq[1]
        else:
            q_index[i] = qq[1]
    """

    t_stack = [1]
    s_stack = [0]
    r_flag = [0] * n
    while len(t_stack) > 0:
        i = t_stack.pop()
        s = s_stack.pop()
        if r_flag[i - 1]:
            continue
        r_flag[i - 1] = 1
        s += q_index[i - 1]
        score[i - 1] += s
        t_stack += t_index[i]
        #for si in range(len(t_index[i])):
        #    s_stack.append(s)
        s_stack += [s] * len(t_index[i])

    s_value = str(score[0])
    for i in range(1, n):
        s_value += " " + str(score[i])
    return s_value


if __name__ == "__main__":
    input_ki = []
    while True:
        try:
            input1 = input()
            if not input1:
                break;
            if len(input1) == 0:
                break;
            s = input1.split(" ")
            input_ki.append([int(s[0]), int(s[1])])
        except EOFError:
            break
    print(get_answer(input_ki))


### FIXED CODE ###

import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
 v,val=map(int,input().split())
 cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
 v=q.pop()
 checked[v]=1 #頂点を見たかどうかのフラグを更新する
 for u in g[v]:
   if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
     continue
   cnt[u]+=cnt[v]
   q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる
### BUGGY CODE ###

MOD = 10**9 + 7
n,k,*a=map(int,open(0).read().split())
a.sort()
comb = 1
ans = 0
for i in range(k,n+1):
    ans += (a[i-1] - a[-i]) * comb
    comb = comb * i // (i-k+1)
    ans = ans%MOD
print(ans)

### FIXED CODE ###

MOD = 10**9 + 7
n,k,*a=map(int,open(0).read().split())
a.sort()
comb = 1
ans = 0
for i in range(k,n+1):
    ans += (a[i-1] - a[-i]) *comb 
    comb = comb * i * pow(i-k+1,MOD-2,MOD) % MOD
    ans = ans%MOD
print(ans)
### BUGGY CODE ###

from collections import deque
n=int(input())
al=[deque(map(int,input().split())) for _ in range(n)]
m=n*(n-1)//2
tn=[n-1]*n
for i in range(m+1):
    flg=True
    s=0
    ts=set()
    for j in range(n):
        if tn[j]>0:
            t=al[j][0]-1
            if t not in ts and j not in ts:
                if al[t][0]==j+1:
                    al[t].popleft()
                    tn[t]-=1
                    ts.add(t)
                    al[j].popleft()
                    tn[j]-=1
                    ts.add(j)
                    flg=False
        s+=tn[j]
    if s==0:
        print(i+1)
        exit()
    if flg:
        print(-1)
        exit()

### FIXED CODE ###

import time
n=int(input())
al=[list(map(int,input().split())) for _ in range(n)]
m=n*(n-1)//2
tn=[n-1]*n
start=time.time()
for i in range(m+1):
    flg=True
    s=0
    ts=set()
    for j in range(n):
        if tn[j]>0 and j not in ts:
            t=al[j][0]-1
            if t not in ts:
                if al[t][0]==j+1:
                    al[t].pop(0)
                    tn[t]-=1
                    ts.add(t)
                    al[j].pop(0)
                    tn[j]-=1
                    flg=False
        ts.add(j)
        s+=tn[j]
    if s==0:
        print(i+1)
        exit()
    if flg:
        print(-1)
        exit()
    now=time.time()
    if (now-start)>1.6:
        print(m)
        exit()
### BUGGY CODE ###

S = input()

ans = 0
_MOD = [0] * 2019
_MOD[0] = 1

for i in range(len(S)):
    j = int(S[i:]) % 2019
    _MOD[j] += 1

for i in range(2019):
    ans += (_MOD[i] * (_MOD[i] - 1)) // 2

print(ans)

### FIXED CODE ###

S = input()[::-1]


_MOD = {0: 1}
amari = 0
a = 1
ans = 0

for i in S:
    amari = (amari + int(i) * a) % 2019
    a = (a * 10) % 2019  #表示桁 1あたりの余
    if amari in _MOD:
        _MOD[amari] = _MOD[amari] + 1
    else:
        _MOD[amari] = 1
    
for amari in _MOD:
    m = _MOD[amari]
    ans += (m * (m - 1)) // 2

print(ans)
### BUGGY CODE ###


N, Q = list(map(int, input().split()))
S = input()
l = [0]*Q
r = [0]*Q
for i in range(Q):
    l[i], r[i] = list(map(int, input().split()))

s = list(S)

for k in range(Q):
    z = "".join(s[l[k]-1:r[k]])
    print(len(z.split("AC"))-1)





### FIXED CODE ###

import sys  
from itertools import accumulate
input = sys.stdin.readline  

N, Q = list(map(int, input().split()))
S = input()

l = [None]*Q
r = [None]*Q
for i in range(Q):
    l[i], r[i] = list(map(int, input().split()))

s = list(S)
ac = [0] * N

for i in range(N-1):
    if s[i] == 'A':
        if s[i+1] == 'C':
            s[i] = "AC"
            ac[i] += 1

ans = list(accumulate(ac))
ans = [0] + ans


for i in range(Q):
    print(ans[r[i]-1]- ans[l[i]-1])
### BUGGY CODE ###

N,M = map(int,input().split())
D = [list(map(int,input().split())) for _ in range(M)]

ans = [0]*N
pas = [M+1]*N
ans[0] = 1
pas[0] = 0

for i in range(M):
    if D[i][0] > D[i][1]:
        tmp = D[i][1]
        D[i][1] = D[i][0]
        D[i][0] = tmp
D.sort(key=lambda x:x[0])

for i in range(M):
    while ans[D[i][0]-1] == 0:
        D.append(D[i])
        D.pop(i)
    if pas[D[i][0]-1]+1 < pas[D[i][1]-1]:
        pas[D[i][1]-1] = pas[D[i][0]-1]+1
        ans[D[i][1]-1] = D[i][0]
    if pas[D[i][1]-1]+1 < pas[D[i][0]-1]:
        pas[D[i][0]-1] = pas[D[i][1]-1]+1
        ans[D[i][0]-1] = D[i][1]


if 0 not in pas[1:]:
    print('Yes')
    for n in ans[1:]:
        print(n)

else:
    print('No')


### FIXED CODE ###

N,M = map(int,input().split())

V = [[] for _ in range(N)]

for _ in range(M):
    a,b = map(int,input().split())
    a = a-1
    b = b-1
    V[a].append(b)
    V[b].append(a)

from collections import deque

q = deque([0])

ans = [-1]*N
ans[0] = 0

while q:
    v = q.popleft()
    for nv in V[v]:
        if ans[nv] == -1:
            ans[nv] = v + 1
            q.append(nv)

print("Yes")
print(*ans[1:],sep="\n")
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
for i in range(1,N+1):
    try:
        if A[-1]==i:
            B = A.index(i)
            print(N-(B+1))
            del A[B:]
            N=B+1
        else:
            print(0)
    except:
        print(0)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [0]*N
for i in range (len(A)):
    B[A[i]-1] +=1
print('\n'.join(map(str, B)))
### BUGGY CODE ###

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

while len(a)>1:
  a.sort()
  a=[i%a[0] for i in a if a.index(i) != 0] + [a[0]]
  a=[i for i in a if i > 0]

print(a[0])


### FIXED CODE ###

from fractions import gcd
def list_gcd(list):
    c=list[0]
    for i in list:
        c=gcd(c,i)
    return c
n=int(input())
print(list_gcd(list(map(int,input().split()))))
### BUGGY CODE ###

n,q=map(int,raw_input().split())
c=map(int,raw_input().split())
p=[0]*(max(c)+1)
for i in c:
	p[i]=1

for k in range(q):
	m=int(raw_input())
	flag=0
	ans=0
	for i in range(m-1,0,-1):
		for pi in p[i::m]:
			if pi:
				ans=i
				break
		if ans>0:
			break
	print ans

### FIXED CODE ###

N,Q=map(int,raw_input().split())
c=map(int,raw_input().split())

mxc=max(c)
p=[0]*(mxc+1)
for i in c:
    p[i]=1
    
l=[0]*(mxc+1)
num=0
for i in range(mxc+1):
    l[i]=num
    if p[i]:
        num=i
        
for i in range(Q):
    q=int(raw_input())
    sp=mxc
    ans=0
    while 1:
        r=sp%q
        ans=max(ans,r)
        if sp-r<=0:break
        sp=l[sp-r]
    print ans
### BUGGY CODE ###

N, M, Q = map(int, input().split())
LR = [[0 for i in range(501)] for j in range(501)]
for i in range(M):
    L, R = map(int, input().split())
    LR[L][R] += 1
LR2 = [[0 for i in range(501)] for j in range(501)]
for i in range(1, 501):
    for j in range(1, 501):
        LR2[i][j] = LR2[i][j - 1] + LR[i][j]
        
for i in range(Q):
    ans = 0
    p, q = map(int, input().split())
    for i in range(p, q + 1):
        ans = ans + LR2[i][q] - LR2[i][p - 1]
    print(ans)


### FIXED CODE ###

N, M, Q = map(int, input().split())
LR = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    L, R = map(int, input().split())
    LR[L - 1][R - 1] += 1

for i in range(1, N):
    LR[0][i] += LR[0][i - 1]
    LR[i][0] += LR[i - 1][0]

for i in range(1, N):
    for j in range(1, N):
        LR[i][j] = LR[i - 1][j] + LR[i][j - 1] + LR[i][j] - LR[i - 1][j - 1]


for i in range(Q):
    p, q = map(int, input().split())
    p -= 2
    q -= 1
    if p != -1:
        ans = LR[q][q] - LR[q][p] - LR[p][q] + LR[p][p]
    elif p == -1:
        ans = LR[q][q]
    print(ans)
### BUGGY CODE ###

from heapq import heappop, heappush
h, w = map(int, input().split())
sy, sx = map(lambda x : int(x) + 1, input().split())
gy, gx = map(lambda x : int(x) + 1, input().split())
grid = [['#'] * (w + 4) for _ in range(2)]
for y in range(h):
    grid.append(['#', '#'] + [c for c in input()] + ['#', '#'])
grid.append(['#'] * (w + 4))
grid.append(['#'] * (w + 4))

q = [(0, sy, sx)]
visited = set()

ans = 0
while q:
    n, y, x = heappop(q)
    if (y, x) in visited:
        continue
    if y == gy and x == gx:
        ans = n
        q.append((0, 0, 0)) # dummy
        break
    visited.add((y, x))
    for dy in range(-2, 3):
        yy = y + dy 
        for dx in range(-2, 3):
            xx = x + dx
            if grid[yy][xx] == '.' and (not (yy, xx) in visited):
                if abs(dx) + abs(dy) == 1:
                    heappush(q, (n, yy, xx))
                else:
                    heappush(q, (n+1, yy, xx))

print(ans if q else -1)




### FIXED CODE ###

h, w = map(int, input().split())
sy, sx = map(lambda x:int(x) + 1, input().split()) 
gy, gx = map(lambda x:int(x) + 1, input().split()) 
grid = [['#'] * (w + 4) for _ in range(2)]
for _ in range(h):
    grid.append(['#', '#'] + list(input()) + ['#', '#'])
grid.append(['#'] * (w + 4))
grid.append(['#'] * (w + 4))

stack = [(sy, sx)]

move = [(-1, 0), (1, 0), (0, 1), (0, -1)]

visited = set()
ans = 0
while stack:
    edge = set()
    while stack:
        y, x = stack.pop()
        visited.add((y, x))
        if gy == y and gx == x:
            print(ans)
            quit()
        for my, mx in move:
            if (y+my, x+mx) in visited:
                continue
            if grid[y+my][x+mx] == '.':
                stack.append((y+my, x+mx))
            else:
                edge.add((y, x))
    ans += 1
    next_points = set()
    for y, x in edge:
        for dy in range(-2, 3):
            yy = y + dy
            for dx in range(-2, 3):
                xx = x + dx
                if grid[yy][xx] == '.' and not (yy, xx) in visited and not (yy, xx) in next_points:
                    next_points.add((yy, xx))
    stack = list(next_points)
print(-1)
### BUGGY CODE ###

import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
p = intl()
cnt = 0
for i in range(n):
    for j in range(0,i+1):
        if p[j] >= p[i]:pass
        else:break
    if j == i:
        cnt += 1
print(cnt)

### FIXED CODE ###

import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
p = intl()
cnt = 0
m = p[0]
for i in range(n):
    if m > p[i]:
        m = p[i]
    if p[i] <= m:
        cnt += 1
print(cnt)
### BUGGY CODE ###

n = int(input())
h = list(map(int, input().split()))
for i in range(1, n+1):
  print(h.index(i)+1, end =  " ")

### FIXED CODE ###

n = int(input())
h = tuple(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[h[i]-1] = i+1
print(*ans)
### BUGGY CODE ###

import bisect

N,M = map(int,input().split())

AB = []

for i in range(N):

    A,B = map(int,input().split())

    AB.append([A,B])

AB.sort()


day = 1
i = 0
maxi = []
ans = 0

while day <= M:

    if i < N and AB[i][0] == day:

        ind = bisect.bisect_left(maxi,AB[i][1])
        maxi.insert(ind,AB[i][1])
        i += 1
        
    else:

        day += 1
        if len(maxi) > 0:
            ans += maxi.pop(-1)

print (ans)

    


### FIXED CODE ###

import heapq

N,M = map(int,input().split())

AB = []

for i in range(N):

    A,B = map(int,input().split())

    AB.append([A,B])

AB.sort()


day = 1
i = 0
lis = []
ans = 0

while day <= M:

    if i < N and AB[i][0] == day:

        heapq.heappush(lis,-1 * AB[i][1])
        i += 1

    else:

        day += 1

        if len(lis) > 0:
            ans -= heapq.heappop(lis)

print (ans)
### BUGGY CODE ###

#c
n,m =map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
result = 0
for i in range(1,n+1):
    flag = 1
    for j in range(len(ab)):
        
        if i in ab[j]:
            if i == ab[j][0]:
                if h[i-1] <= h[ab[j][1]-1]:
                    flag = 0
                    break
            else:
                if h[i-1] <= h[ab[j][0]-1]:
                    flag = 0
                    break
    
    if flag == 1:
        result += 1
print(result)

### FIXED CODE ###

#c
n,m =map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]
result = []
for i in ab:
    if h[i[0]-1] > h[i[1]-1]:
        result.append(i[1])
    elif h[i[1]-1] > h[i[0]-1]:
        result.append(i[0])
    else:
        result.append(i[0])
        result.append(i[1])
result = list(set(result))
print(n - len(result))
### BUGGY CODE ###

INF = -10**11
x, y, z, k = [int(item) for item in input().split()]
a = sorted([int(item) for item in input().split()], reverse=True) + [INF]
b = sorted([int(item) for item in input().split()], reverse=True) + [INF]
c = sorted([int(item) for item in input().split()], reverse=True) + [INF]

num = x + y + z
ac, bc, cc = 0, 0, 0
ad = a[0] - a[1]
bd = b[0] - b[1]
cd = c[0] - c[1]
kadd = min(60000, x*y*z)
while (ac+1) * (bc+1) * (cc+1) < kadd:
    if ad <= bd and ad <= cd:
        ac += 1
        ad = a[ac] - a[ac+1]
    elif bd <= ad and bd <= cd:
        bc += 1
        bd = b[bc] - b[bc+1]
    elif cd <= ad and cd <= bd:
        cc += 1
        cd = c[cc] - c[cc+1]

for i in range(50):
    if ac+1 < x:
        ac += 1
    if bc+1 < y:
        bc += 1
    if cc+1 < z:
        cc += 1

vals = []
for ai in a[:ac+1]:
    for bi in b[:bc+1]:
        for ci in c[:cc+1]:
            vals.append(ai+bi+ci)
vals.sort(reverse=True)
for i in range(k):
    print(vals[i])

### FIXED CODE ###

INF = -10**11
x, y, z, k = [int(item) for item in input().split()]
a = sorted([int(item) for item in input().split()], reverse=True) + [INF]
b = sorted([int(item) for item in input().split()], reverse=True) + [INF]
c = sorted([int(item) for item in input().split()], reverse=True) + [INF]

num = x + y + z
ac, bc, cc = 0, 0, 0
ad = a[0] - a[1]
bd = b[0] - b[1]
cd = c[0] - c[1]
kadd = min(12000, x*y*z)
while (ac+1) * (bc+1) * (cc+1) < kadd:
    if ad <= bd and ad <= cd:
        ac += 1
        ad = a[ac] - a[ac+1]
    elif bd <= ad and bd <= cd:
        bc += 1
        bd = b[bc] - b[bc+1]
    elif cd <= ad and cd <= bd:
        cc += 1
        cd = c[cc] - c[cc+1]

for i in range(30):
    if ac+1 < x:
        ac += 1
    if bc+1 < y:
        bc += 1
    if cc+1 < z:
        cc += 1

vals = []
for ai in a[:ac+1]:
    for bi in b[:bc+1]:
        for ci in c[:cc+1]:
            vals.append(ai+bi+ci)
vals.sort(reverse=True)
for i in range(k):
    print(vals[i])
### BUGGY CODE ###

na,nb,k = map(int, input().split())
ta = list(map(int, input().split()))
tb = list(map(int, input().split()))


def get_bcnt( usek,tb=tb ):
    tb_sum = [ sum(tb[:i]) + tt for i, tt in enumerate(tb)]
    tb_sum_tf = [ i <= usek for i in tb_sum]
    
    if False in tb_sum_tf:
        return tb_sum_tf.index(False)
    else:
        return len(tb)
    
 
readbook = [ i+1 + get_bcnt( k - sum( ta[:i] ) )  for i in range(na) if sum( ta[:i+1] ) <= k ]
readbook.append( get_bcnt(k) )
print( max(readbook) )

### FIXED CODE ###

na,nb,k = map(int, input().split())
ta = list(map(int, input().split()))
tb = list(map(int, input().split()))

a = [0]
for i in range(na):
  a.append( a[i] + ta[i] )
b = [0]
for i in range(nb):
  b.append( b[i] + tb[i] )

ans, j=0, nb
for i in range(na + 1):
  if a[i] > k:
    break
  while True:
    if a[i] + b[j] > k:
      j -= 1
    else:
      break
  ans = max(ans, i+j)
    
print(ans)
### BUGGY CODE ###

N = int(input())
 
yakusu = [0] * (N)
for i in range(1,N):
    for j in range(1,min(i, int((N-1)/i))+1):
      M = i*j
      if i == j:
        yakusu[M] += 1
      else:
        yakusu[M] += 2

print(sum(yakusu[1:N]))

### FIXED CODE ###

N = int(input())

counter = 0
for i in range(1,N):
    for j in range(1,min(i, int((N-1)/i))+1):
      if i == j:
        counter += 1
      else:
        counter += 2

print(counter)
### BUGGY CODE ###

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

#print(N)
#print(List[0])
i_ok_count=0
break_flag=0
for i in range(len(List)):
  #print(i+1)#i
  for j in range(i):
    if List[i]>List[j]:
      break_flag=1
      break
  if break_flag!=1:
    i_ok_count+=1
  break_flag=0

print(i_ok_count)

### FIXED CODE ###

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

counter=0
mj=N
for i in range(N):
  if mj>List[i]:
    mj=List[i]
  if List[i]==mj:
    counter+=1
print(counter)
### BUGGY CODE ###

n=int(input())
List=list(map(int,input().split()))
ans=1
for i in range(len(List)):
    ans*=List[i]
if ans<=10**18:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

import sys
n=int(input())
List=list(map(int,input().split()))
List.sort(reverse=True)
if 0 in List:
    print(0)
    sys.exit()
ans=1
for i in List:
    if ans<=10**18:
        ans*=i
    else:
        print(-1)
        sys.exit()
if ans<=10**18:
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+2):
    for g in range((N-r*R)//G+2):
        if N - r*R - g*G >= 0 and (N - r*R - g*G) % B == 0:
            ans += 1
print(ans)

### FIXED CODE ###

R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N - r*R - g*G) % B == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

from operator import mul
from functools import reduce

def C(n, r):
  if r == 1:
    return n
  nume = reduce(mul, range(n, n - r, -1))
  deno = reduce(mul, range(1, r+1))
  return nume // deno

n, a, b = map(int, input().split())

mod = 10 ** 9 + 7

if n == 2:
   print(0)
   exit()
                
S = pow(2, n, mod)
A = C(n, a) % mod
B = C(n, b) % mod

print(S - A - B - 1)

### FIXED CODE ###

n, a, b = map(int, input().split())
 
mod = 10 ** 9 + 7
 
if n == 2:
   print(0)
   exit()
                
S = pow(2, n, mod) -1 

x1 = 1
y1 = 1
for i in range(a):
  x1 = x1 * (n-i) % mod
  y1 = y1 * (i+1) % mod
A = (x1 * pow(y1, mod - 2, mod)) % mod

x2 = 1
y2 = 1
for i in range(b):
  x2 = x2 * (n-i) % mod
  y2 = y2 * (i+1) % mod
B = (x2 * pow(y2, mod - 2, mod)) % mod

print((S - A - B) % mod)
### BUGGY CODE ###

import bisect

N = int(input())

tops = []

for i in range(N):
    a = int(input())
    # 二分探索
    # aより小さい値の中で最大値の添え字 + 1
    p = bisect.bisect_left(tops, a)
    
    if p == 0:
        bisect.insort_left(tops, a)
    else:    
        tops[p-1] = a
        
print(len(tops))


### FIXED CODE ###

import bisect
from collections import deque

N = int(input())

tops = deque() 

for i in range(N):
    a = int(input())
    p = bisect.bisect_left(tops, a)
    
    if p == 0:
        tops.appendleft(a)
    else:    
        tops[p-1] = a
        
print(len(tops))