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

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
H = LIST()
I = []

if N == 1:
  print(0)
  exit()

for i in range(N):
  c = 0
  s = 1
  for j in range(N-i-1):
    if H[i+j] >= H[i+j+1]:
      s *= 1
      c += s
    else:
      s *= 0
      c += s
    I.append(c)
    
print(int(max(I)))

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
H = LIST()
I = []

if N == 1:
  print(0)
  exit()
  
i = 0
 
while i < N :
  c = 0
  j = 0
  while j < N-i-1 and H[i+j] >= H[i+j+1] :
    c += 1
    j += 1
    
  I.append(c)
  i += c+1
  
print(int(max(I)))
### BUGGY CODE ###

# coding: utf-8

a, b, c, d = map(int, input().split())

count = 0

for i in range(a, b+1):
    if i % c == 0 or i % d == 0:
        continue
    count += 1

print(count)



### FIXED CODE ###

# coding: utf-8

import fractions

a, b, c, d = map(int, input().split())

def lcm(x, y):
    return x * y // fractions.gcd(x, y)

a_c = (a-1) // c
a_d = (a-1) // d
a_cd = (a-1) // lcm(c, d)

b_c = b // c
b_d = b // d
b_cd = b // lcm(c, d)


print((b-a+1) - ((b_c + b_d - b_cd) - (a_c + a_d - a_cd)))
### BUGGY CODE ###

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

divs_A = set()
for i in range(1, A+1):
    if A % i == 0:
        divs_A.add(i)
        
divs_B = set()
for i in range(1, B+1):
    if B % i == 0:
        divs_B.add(i)

divs = list(divs_A & divs_B)

results = []
for div in divs[1:]:
    flag = True
    for result in results:
        if div % result == 0:
            flag = False
            break
    if flag:
        results.append(div)

print(len(results) + 1)

### FIXED CODE ###

from fractions import gcd

def FindAllDivisors(x):
    divList = []
    y = 1
    while y <= x**0.5:
        if x % y == 0:
            divList.append(y)
            divList.append(int(x / y))
        y += 1
    return sorted(list(set(divList)))

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

max_divs = gcd(A, B)
divs = FindAllDivisors(max_divs)

results = []
for div in divs[1:]:
    flag = True
    for result in results:
        if div % result == 0:
            flag = False
            break
    if flag:
        results.append(div)

print(len(results) + 1)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    if 1 not in a:
        print(-1)
        return
    ans = 0
    for i in range(1, N):
        try:
            idx = a.index(i)
            a = a[idx:]
            ans += idx if i == 1 else idx - 1
        except Exception:
            ans += len(a) - 1
            break
    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
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, a: "List[int]"):
    if 1 not in a:
        print(-1)
        return
    ans = 0
    nxt = 1
    for i in range(N):
        if a[i] == nxt:
            nxt += 1
        else:
            ans += 1
    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
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


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

n, m = map(int, input().split())
x = list(map(int, input().split()))
x.reverse()
mincost = 2 * n * m + 5 * sum(x)
for k in range(1,n):
    cost = m * (n + k)
    for i in range(n):
        cost += max(5, 3 + i//k * 2) * x[i]
    mincost = min(mincost, cost)
print(mincost)

### FIXED CODE ###

n, m = map(int, input().split())
x = list(map(int, input().split()))
x.reverse()
cum = [0] * (n+1)
for i in range(n):
    cum[i+1] = cum[i] + x[i]
mincost = 2 * n * m + 5 * cum[n]
for k in range(1,n):
    cost = m * (n + k)
    for i in range(n//k):
        cost += (cum[(i+1)*k] - cum[i*k]) * max(5, 3 + i*2)
    cost += (cum[n] - cum[n//k * k]) * max(5, 3 + n//k*2)
    mincost = min(mincost, cost)
print(mincost)
### BUGGY CODE ###

import math

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

def C(N,P):
    if N == 1: return P
    if N > 40: return 1
    b=int(math.log2(N))
    a=int(P**(1/b))+2

    res=1
    for i in range(2,a):
        c=i**N
        if P % c == 0 : res = i

    return res

print(C(n,p))

### FIXED CODE ###

n,p = list(map(int,input().split())) 
i = a = o = 1
m = round(p**(1/n))
for i in range(m,0,-1):
    a = i**n
    if p%a==0:
        print(i)
        exit()
### BUGGY CODE ###

#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
def LI(): return [int(x) for x in sys.stdin.readline().split()]

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

def solve():
    h,w,k = LI()
    y,x,s,t = LI()
    y -= 1
    x -= 1
    s -= 1
    t -= 1
    c = [input() for i in range(h)]
    cost = 1/k
    d = defaultdict(lambda : float("inf"))
    q = []
    for i in range(4):
        d[(y,x,i)] = 0
        q.append((0,y,x,i))

    while q:
        dyx,y,x,p = heappop(q)
        if (y,x) == (s,t):
            print(math.ceil(round(dyx,6)))
            return
        if d[(y,x,p)] < dyx:
            continue

        for i,(dy,dx) in enumerate(dd):
            if i == p:
                nd = dyx + cost
            else:
                nd = math.ceil(round(dyx,6)) + cost
            ny,nx = y+dy, x+dx
            if 0 <= ny < h and 0 <= nx < w:
                if c[ny][nx] != "@":
                    if nd < d[(ny,nx,i)]:
                        d[(ny,nx,i)] = nd
                        heappush(q,(nd,ny,nx,i))
    print(-1)
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
import sys
import math
def LI(): return [int(x) for x in sys.stdin.readline().split()]

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

def solve():
    h,w,k = LI()
    y,x,s,t = LI()
    y -= 1
    x -= 1
    s -= 1
    t -= 1
    c = [input() for i in range(h)]
    q = deque([(y,x)])
    d = [[float("inf")]*w for i in range(h)]
    d[y][x] = 0
    while q:
      y,x = q.popleft()
      if (y,x) == (s,t):
          print(d[s][t])
          return
      nd = d[y][x] + 1
      for dy,dx in dd:
          ny,nx = y,x
          for _ in range(k):
              ny += dy
              nx += dx
              if 0 <= ny < h and 0 <= nx < w and c[ny][nx] != "@" and nd <= d[ny][nx]:
                  if nd < d[ny][nx]:
                      d[ny][nx] = nd
                      q.append((ny,nx))
                  continue
              break
    print(-1)
    return

#Solve
if __name__ == "__main__":
    solve()
### BUGGY CODE ###

class Node:
	elm = None
	next = None
	prev = None

class MyList:
	head = tail = None

	def insert(self, x):
		n = Node()
		n.elm = x
		if self.head == None:
			self.head = self.tail = n
		else:
			n.next = self.head
			self.head.prev = n
			self.head = n

	def delete(self, x):
		n = self.head
		while n and n.elm != x:
			n = n.next
		self.__delete_node(n)

	def deleteFirst(self):
		self.__delete_node(self.head)

	def deleteLast(self):
		self.__delete_node(self.tail)

	def __delete_node(self, n):
		if n == None: 
			return
		if n == self.head:
			self.head = n.next
		if n == self.tail:
			self.tail = n.prev
		if n.prev:
			n.prev.next = n.next
		if n.next:
			n.next.prev = n.prev

	def __traverse(self):
		n = self.head
		while n:
			yield n.elm
			n = n.next

	def __str__(self):
		return " ".join([s for s in self.__traverse()])

myList = MyList()
n = int(raw_input())
for _ in xrange(n):
	line = raw_input()
	if line[0]=='i':
		myList.insert(line[7:])
	elif line[6]=='F':
		myList.deleteFirst()
	elif line[6]=='L':
		myList.deleteLast()
	else:
		myList.delete(line[7:])
print myList

### FIXED CODE ###

class MyList:
	head = tail = None

	def insert(self, x):
		n = [x, None, None]
		if self.head == None:
			self.head = self.tail = n
		else:
			n[2] = self.head
			self.head[1] = n
			self.head = n

	def delete(self, x):
		n = self.head
		while n and n[0] != x:
			n = n[2]
		if n: 
			self.__delete_node(n)

	def deleteFirst(self):
		self.__delete_node(self.head)

	def deleteLast(self):
		self.__delete_node(self.tail)

	def __delete_node(self, n):
		if n == self.head:
			self.head = n[2]
		if n == self.tail:
			self.tail = n[1]
		if n[1]:
			n[1][2] = n[2]
		if n[2]:
			n[2][1] = n[1]

	def print_all(self):
		n = self.head
		while n:
			print n[0],
			n = n[2]

myList = MyList()
n = int(raw_input())
for _ in xrange(n):
	line = raw_input()
	if line[0]=='i':
		myList.insert(line[7:])
	elif line[6]=='F':
		myList.deleteFirst()
	elif line[6]=='L':
		myList.deleteLast()
	else:
		myList.delete(line[7:])
myList.print_all()
### BUGGY CODE ###

import sys
#input = sys.stdin.buffer.readline
import numpy as np

def main():
    N = int(input())
    s = input()
    dp = np.zeros((N+1,N+1),dtype=int)
    for i in range(N):
        for j in range(i+1,N):
            if s[i] == s[j]:
                dp[i+1][j+1] = min(dp[i][j]+1,j-i)

    print(dp.max())

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
#input = sys.stdin.buffer.readline

def main():
    N = int(input())
    s = input()
    a,i,j = 0,0,1
    
    while j < N:
        if s[i:j] in s[j:]:
            a = max(a,j-i)
            j += 1
        else:
            i += 1
        if i == j:
            i += 1
            j += 2
            
    print(a)

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

n=int(input())
Q=input().split()
q=int(input())
S=input().split()

Q=list(map(int,Q))
S=list(map(int,S))

cnt=0

for i in range(q):
	left=0
	right=n-1
	while left<=right:
		mid=int((n-1)/2)
		if S[mid]==Q[i]:
			cnt+=1
			break
		elif S[mid]>Q[i]:
			right=mid
		elif S[mid]<Q[i]:
			left=mid

print(cnt)


### FIXED CODE ###

n=int(input())
S=input().split()
q=int(input())
T=input().split()

S=list(map(int,S))
T=list(map(int,T))

cnt=0

for i in range(q):
	left=0
	right=n-1
	while left<=right:
		mid=int((left+right)/2)
		if S[left]>T[i] and S[right]<T[i]:
			break
		if S[mid]==T[i]:
			cnt+=1
			break
		elif S[mid]>T[i]:
			right=mid-1
		elif S[mid]<T[i]:
			left=mid+1

print(cnt)
### BUGGY CODE ###

import sys
s = str(input())
Q = int(input())
q = sys.stdin.readlines()
cnt = 0

for i in q:
  if i[0] == '1':
    cnt = (cnt+1) % 2
  elif i[2] == '1':
    if cnt == 0:
      s = i[4] + s
    else:
      s += i[4]
  else:
    if cnt == 0:
      s += i[4]
    else:
      s = i[4] + s

if cnt == 0:
  print(s)
else:
  print(s[::-1])

### FIXED CODE ###

from collections import deque
import sys
s = deque(list(input()))
Q = int(input())
cnt = 0

for i in range(Q):
  q = list(input().split())
  if q[0] == '1':
    cnt = (cnt+1) % 2
  elif q[1] == '1':
    if cnt == 0:
      s.appendleft(q[2])
    else:
      s.append(q[2])
  else:
    if cnt == 0:
      s.append(q[2])
    else:
      s.appendleft(q[2])

if cnt == 1:
  s.reverse()
print("".join(s))
### BUGGY CODE ###

from itertools import combinations
N, K = map(int, input().split())
xy = [tuple(map(int, input().split())) for i in range(N)]

ans = float("inf")
for p1, p2 in combinations(xy, 2):
    x1 = p1[0]
    x2 = p2[0]
    if x2 < x1:
        x1, x2 = x2, x1
        #x2 > x1
    for p3, p4 in combinations(xy, 2):
        y1 = p3[1]
        y2 = p4[1]
        if y2 < y1:
            y1, y2 = y2, y1
        # y2 >= y1
        count = 0
        for x, y in xy:
            if x >= x1 and x <= x2 and y >= y1 and y <= y2:
                count += 1

        if count >= K:
            ans = min(ans, (x2-x1)*(y2-y1))


print(ans)


### FIXED CODE ###

from itertools import combinations
N, K = map(int, input().split())
xy = [tuple(map(int, input().split())) for i in range(N)]

ans = float("inf")
for p1, p2 in combinations(xy, 2):
    x1 = p1[0]
    x2 = p2[0]
    if x2 < x1:
        x1, x2 = x2, x1
        #x2 > x1
    for p3, p4 in combinations(xy, 2):
        y1 = p3[1]
        y2 = p4[1]
        if y2 < y1:
            y1, y2 = y2, y1
        # y2 >= y1
        count = 0
        for x, y in xy:
            if x >= x1 and x <= x2 and y >= y1 and y <= y2:
                count += 1

        if count >= K:
            ans = min(ans, (x2-x1)*(y2-y1))


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

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

y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp
#print(x)

p = [1]
for val in range(2,x+1):
  flag = 1
  if x % val == 0:
    for i in range(2,int(math.sqrt(val))+1):
      if val % i == 0:
        flag = 0
    if flag == 1:
      p.append(val)
print(len(p))

  
  

### FIXED CODE ###

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

# 最大公約数の算出
y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp

# 素因数分解
p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p.append(1)
p = list(set(p))
print(len(p))
### BUGGY CODE ###

import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# S = input().strip

x = 0
y = N

p = [None] * N
print(x)
p[x] = input().strip()

while True:
    m = (x + y) // 2
    print(m)

    s = input().strip()
    if s == "Vacant":
        exit()
    else:
        if p[x] == s:
            if (m - x) % 2 == 0:
                x = m
                p[x] = s
            else:
                y = m
                p[y] = s
        else:
            if (m - x) % 2 == 0:
                y = m
                p[y] = s
            else:
                x = m
                p[x] = s

### FIXED CODE ###

import sys
from collections import defaultdict
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# S = input().strip

x = 0
y = N

p = [None] * N
print(x, flush = True)
p[x] = input().strip()

for _ in range(20):
    m = (x + y) // 2
    print(m, flush = True)

    s = input().strip()
    if s == "Vacant":
        exit()
    else:
        if p[x] == s:
            if (m - x) % 2 == 0:
                x = m
                p[x] = s
            else:
                y = m
                p[y] = s
        else:
            if (m - x) % 2 == 0:
                y = m
                p[y] = s
            else:
                x = m
                p[x] = s
### BUGGY CODE ###

s=str(input())
arr=[]
for i in range(len(s)):
	arr.append(s[i])
ans=0
n=len(arr)
for i in range(len(s)-2):
	if(arr[i]+arr[i+1]+arr[i+2]=="ABC"):
		ans+=1
		arr[i]="B"
		arr[i+1]="C"
		arr[i+2]="A"
		j=i-1
		while(j>=0 and arr[j]=="A"):
			ans+=1
			arr[j]="B"
			arr[j+1]="C"
			arr[j+2]="A"
			j-=1
print(ans)







### FIXED CODE ###

s=str(input())
arr=[]
for i in range(len(s)):
	arr.append(s[i])
ans=0
n=len(arr)
count=0
i=0
while(i<n-2):
	if(arr[i]+arr[i+1]+arr[i+2]=="ABC"):
		ans+=1
		arr[i]="B"
		arr[i+1]="C"
		arr[i+2]="A"
		j=i-1
		i+=2
		ans+=count
	else:
		if(arr[i]=="A"):
			count+=1
		else:
			count=0
		i+=1
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
import functools
import fractions 
mod=pow(10,9)+7
# 最小公倍数
def lcm(x, y):
  return ((x * y) // fractions.gcd(x, y))
def lcmn(nums):
  return functools.reduce(lcm, nums)
lcma=lcmn(a)
ans=0
for ai in a:
  ans+=lcma//ai
  ans%=mod
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
mod=pow(10,9)+7

#n=10000
#a=list(range(10**6,10**6-n,-1))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
lcma={}
for ai in a:
  f=factorization(ai)
  for fi in f:
    if fi[0] in lcma:
      lcma[fi[0]]=max(lcma[fi[0]],fi[1])
    else:
      lcma[fi[0]]=fi[1]
l=1
for k,v in lcma.items():
  l*=pow(k,v,mod)
  l%=mod
ans=0
for ai in a:
  ans+=l*pow(ai,mod-2,mod)
  ans%=mod
print(ans)
### BUGGY CODE ###

from math import gcd
n = int(input())
a = list(map(int, input().split()))
g = 0
for i in range(n):
    g = gcd(g, a[i])
cur = a[0]
f = False
for i in range(1, n):
    if gcd(cur, a[i]) != 1:
        f = True
        break
    cur *= a[i] // gcd(cur, a[i])
if not f:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###

import math
def prime_numbers(x):
    if x < 2:
        return []
    prime_numbers = [i for i in range(x)]
    prime_numbers[1] = 0
    for prime_number in prime_numbers:
        if prime_number > math.sqrt(x):
            break
        if prime_number == 0:
            continue
        for composite_number in range(2 * prime_number, x, prime_number):
            prime_numbers[composite_number] = 0
    return [prime_number for prime_number in prime_numbers if prime_number != 0]
def soinnsuu(x):
    s = set()
    for i in primes:
        if i > int(math.sqrt(x)):
            break
        elif x % i == 0:
            while x % i == 0:
                x //= i
            s.add(i)
    if not x == 1:
        s.add(x)
    return s
from math import gcd
n = int(input())
a = list(map(int, input().split()))
g = 0
for i in range(n):
    g = gcd(g, a[i])
primes = prime_numbers(2000000)
cur = soinnsuu(a[0])
f = False
for i in range(1, n):
    s2 = soinnsuu(a[i])
    if len(cur & s2) >= 1:
        f = True
        break
    cur |= s2
if not f:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

import bisect
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29


def main():
    H,W  =isRaw()
    ss = [sRaw() for _ in range(H)]
    memo = [[INF for _ in range(W)] for _ in range(H)]
    qu = deque()
    isF = 1 if ss[0][0] == "#" else 0
    qu.append([0, 0, isF, isF])
    ans = INF
    while len(qu) != 0:
        x, y, z, isF = qu.popleft()
        if x != W-1:
            nx = x+1
            nisF = 1 if ss[y][nx] == "#" else 0
            z2 = z
            if nisF == 1 and isF == 0:
                z2 += 1
            if memo[y][nx] < z2:
                continue
            memo[y][nx]=z2
            if nx == W-1 and y == H-1:
                ans = min(ans, z2)
                continue
            qu.append([nx, y, z2, nisF])
        if y != H-1:
            ny = y+1
            nisF = 1 if ss[ny][x] == "#" else 0
            z2 = z
            if nisF == 1 and isF == 0:
                z2 += 1
            if memo[ny][x] < z2:
                continue
            memo[ny][x] = z2
            if x == W-1 and ny == H-1:
                ans = min(ans, z2)
                continue
            qu.append([x, ny, z2, nisF])

    return ans

    
if __name__ == "__main__":
    print(main())


### FIXED CODE ###

import bisect
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29


def main():
    H,W  =isRaw()
    ss = [sRaw() for _ in range(H)]
    memo = [[INF for _ in range(W)] for _ in range(H)]
    qu = deque()
    isF = 1 if ss[0][0] == "#" else 0
    ans = INF
    memo[0][0] = isF
    for y in range(H):
        for x in range(W):
            s = ss[y][x]
            if x!=0:
                prevM = memo[y][x-1]
                prevS = ss[y][x-1]
                if s=="#" and prevS!="#":
                    memo[y][x] = min(memo[y][x],prevM+1)
                else:
                    memo[y][x] = min(memo[y][x], prevM)
            if y!=0:
                prevM = memo[y-1][x]
                prevS = ss[y-1][x]
                if s == "#" and prevS != "#":
                    memo[y][x] = min(memo[y][x], prevM+1)
                else:
                    memo[y][x] = min(memo[y][x], prevM)
    return memo[H-1][W-1]

    
if __name__ == "__main__":
    print(main())
### BUGGY CODE ###

n = int(input())
p = list(map(int,input().split()))
ans = 1 #i=1は常に成り立つ
 
for i in range(1, n): #i=2以降について順番に見ていく
  for j in range(0, i): #iより小さい要素について順番に見ていく
    if p[j] < p[i]: #jの方が小さかったら
      break #ダメなので抜ける
    if j == i-1: #j=i-1になったら
      ans = ans + 1 #要件を満たすので+1する
  if p[i] == 1:
    break
  
print(ans)

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))
mini = p[0]
ans = 1

for i in p:
    if i < mini:
        ans += 1
        mini = i

print(ans)