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

h, w = map(int, input().split())
grid = []
for _ in range(h):
    grid.append(input())
res = 0
for i in range(h):
    for j in range(w):
        if grid[i][j] != '.':
            continue
        visited = []
        queue = [(i, j, 0)]
        while queue:
            c_i, c_j, level = queue.pop(0)
            visited.append((c_i, c_j))
            for n_i, n_j in ((c_i - 1, c_j), (c_i + 1, c_j), (c_i, c_j - 1), (c_i, c_j + 1)):
                if 0 <= n_i < h and 0 <= n_j < w and grid[n_i][n_j] == '.' and (n_i, n_j) not in visited:
                    queue.append((n_i, n_j, level + 1))
        res = max(res, level)
print(res)        

### FIXED CODE ###

h, w = map(int, input().split())
grid = []
for _ in range(h):
    grid.append(list(input()))
res = 0
for i in range(h):
    for j in range(w):
        if grid[i][j] != '.':
            continue
        visited = [[False for _ in range(w)] for _ in range(h)]
        visited[i][j] = True
        queue = [(i, j, 0)]
        while queue:
            c_i, c_j, level = queue.pop(0)
#             visited.append((c_i, c_j))
            for n_i, n_j in ((c_i - 1, c_j), (c_i + 1, c_j), (c_i, c_j - 1), (c_i, c_j + 1)):
                if 0 <= n_i < h and 0 <= n_j < w and grid[n_i][n_j] == '.' and visited[n_i][n_j] == False:
                    queue.append((n_i, n_j, level + 1))
                    visited[n_i][n_j] = True
        res = max(res, level)
print(res)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n,m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
a.sort()
bc=[None]*m
for i in range(m):
    bc[i] = list(map(int, input().split(" ")))
bc = sorted(bc, key=lambda x:x[1], reverse=True)
for [b,c] in bc:
    if c < a[0]:
        break
    for i in range(b):
        if c < a[i]:
            break
        a[i] = c
    a = a[b:] + [sum(a[0:b])]
print(sum(a))

### FIXED CODE ###

import sys
input = sys.stdin.readline
n,m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
a.sort()
bc=[None]*m
for i in range(m):
    bc[i] = list(map(int, input().split(" ")))
bc.sort(reverse=True, key=lambda x:x[1])
l=[]
for [b,c] in bc:
    l.extend([c]*b)
    if n < len(l):
        break
for i in range(n):
    if len(l) <= i or l[i] <= a[i]:
        break
    a[i] = l[i]
print(sum(a))
### BUGGY CODE ###

n, q = map(int, input().split())
gu = [set() for _ in range(n)]
gl = [set() for _ in range(n)]

def upper(a,b):
  if gu[a] == {}:
    gl[a].add(b)
  else:
    gl[a].add(b)
    for l in gu[a]:
      upper(l, b)

for i in range(n-1):
  a, b = map(int,input().split())
  a, b = a-1, b-1
  gu[b].add(a)
  upper(a,b)

#print(gu)
#print(gl)

c = [0]*n
for j in range(q):
  x, p = map(int, input().split())
  x = x-1
  c[x] += p
  for k in gl[x]:
    c[k] += p

print(' '.join(map(str, c)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

n, q = map(int, input().split())
g = [[] for _ in range(n)]
for i in range(n-1):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  g[a].append(b)
  #g[b].append(a)

ans = [0]*n  
for j in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x
  
from collections import deque
s = deque()
s.append(0)

while s:
  v = s.pop()
  for v_ in g[v]:
    ans[v_] += ans[v]
    s.append(v_)

print(' '.join(map(str, ans)))
### BUGGY CODE ###

N, *d = map(int, open(0).read().split())
allmax = 0
for i in range(N):
    if d[i] > allmax:
        allmax = d[i]
for i in range(N):
    max = 0
    for j in range(N):
        if(i == j):
            continue
        if d[j] > max:
            max = d[j]
            if max == allmax:
                break
    print(max)

### FIXED CODE ###

N, *d = map(int, open(0).read().split())
allmax = max(d)
allMaxCount = d.count(allmax)
for i in range(N):
    max = 0
    if(allMaxCount > 1 or d[i] != allmax):
        max = allmax
    else:
        for j in range(N):
            if(i == j):
                continue
            if d[j] > max:
                max = d[j]
                if max == allmax:
                    break
    print(max)
### BUGGY CODE ###

import math

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
Ar = A[::-1]
Ai = [Ar[i] - A[i] for i in range(N)]
ans = 0

n, r = N-1, K-1 
C = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(N-K+1):
    ans += Ai[i] * C
    C *= N-i-K
    if N-i-1 != 0:
        C //= N-i-1

print(ans % 1000000007)

### FIXED CODE ###

N, K = map(int, input().split())
MOD = 10**9+7
A = [a % MOD for a in sorted(list(map(int, input().split())))]
MIN, MAX = 0, 0

def div_MOD(a):     # (a^{-1} mod MOD) をフェルマーの小定理より求める
    return pow(a, MOD - 2, MOD)     # a^{-1} = a^{p-2} (mod p)

C = [0]*(K-1) + [1]
for n in range(K, N):
    C.append((C[n-1] * n * div_MOD(n-(K-1))) % MOD)

for i in range(N-K+1):
    MIN = (MIN + (A[i] * C[N-i-1]) % MOD) %MOD
for i in range(N-K+1):
    MAX = (MAX + (A[N-1-i] * C[N-i-1]) % MOD) %MOD

print((MAX - MIN) % MOD)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
S = input()
judge = [0] * 1
tmp = ''
ans = 0
m = ''

for n in range(0, len(S)):
	m += S[n]
	judge[0] = m
	#print(judge)

	for i in range(len(m), len(S)):
		tmp += S[i]
		
		for j in range(len(judge) - 1, len(judge)):
			if judge[j] == tmp:
				break

		else:
			judge.append(tmp)
			tmp = ''
	
	else:
		ans = max(ans, len(judge))
		judge = [0] * 1

print(ans)

### FIXED CODE ###

S = input()
dp = [0] * (len(S) + 1)
dp[1] = 1

if S[0] == S[1]:
	dp[2] = 1
else:
	dp[2] = 2

for i in range(3, len(S) + 1):
	if S[i - 1] != S[i - 2]:
		dp[i] = dp[i - 1] + 1
	else:
		dp[i] = dp[i - 3] + 2

print(dp[-1])
### BUGGY CODE ###

N,M = map(int,input().split())
C = []
for _ in range(N):
    A,B = map(int,input().split())
    C.append([A,B])
C = sorted(C,key=lambda x:x[0],reverse=True)
C = sorted(C,key=lambda x:x[1],reverse=True)
rev = 0
hist = [0 for _ in range(M+1)]
for x in C:
    A,B = x[0],x[1]
    for i in range(M-A,-1,-1):
        if hist[i]==0:
            rev += B
            hist[i]=1
            break
print(rev)

### FIXED CODE ###

import bisect
N,M = map(int,input().split())
C = []
for _ in range(N):
    A,B = map(int,input().split())
    C.append([A,B])
C = sorted(C,key=lambda x:x[0],reverse=True)
C = sorted(C,key=lambda x:x[1],reverse=True)
rev = 0
hist = list(range(0,M+1))
for x in C:
    A,B = x[0],x[1]
    ind = bisect.bisect_right(hist,M-A)
    if ind>0:
        hist.pop(ind-1)
        rev += B
print(rev)
### BUGGY CODE ###

from math import gcd
from functools import reduce
from itertools import product

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]

  results = [A.count(i) for i in range(1, N+1)]

  for result in results:
    print(result)
    
if __name__ == "__main__":
  resolve()

### FIXED CODE ###

from collections import Counter

def resolve():
  N = int(input())
  A = [int(x) for x in input().split(" ")]
  collection = Counter(A)
  for i in range(1, N + 1):
    print(collection[i])
  # results = [str(A.count(i))+'\n' for i in range(1, N+1)]
  # print('\n'.join(results))

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

import itertools

n,m,q = map(int,input().split())

number = []
for i in range(m):
    number.append(i+1)
a = list(itertools.combinations_with_replacement(number,n))
length = len(a)
memo = [0] * length

for i in range(q):
    num = list(map(int,input().split()))
    for j in range(length):
        if int(a[j][num[1]-1])-int(a[j][num[0]-1]) == int(num[2]):
            memo[j] += num[3]
print(max(memo))



### FIXED CODE ###

import itertools

n,m,q = map(int,input().split())
num = [list(map(int,input().split())) for i in range(q)]

number = []
for i in range(m):
    number.append(i+1)
a = list(itertools.combinations_with_replacement(number,n))
length = len(a)
memo = [0] * length
ans = 0

for i in range(length):#組み合わせの数回す
    sum = 0
    for j in range(q):
       if a[i][num[j][1]-1] - a[i][num[j][0]-1]  == num[j][2]:
            sum += num[j][3]
    ans = max(sum,ans)
print(ans)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
M=1
for j in A:
	M=M*j
if M>10**18:
	M=-1
print(M)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
M=1
A.sort()
if A[0]==0:
	M=0
else:
	for j in A:
		M=M*j
		if M>10**18:
			M=-1
			break
print(M)
### BUGGY CODE ###

#!/usr/bin/env python3
import itertools
import numpy as np

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

v = np.array(v)
c = np.array(c)

ans = 0
for i in itertools.product([0, 1], repeat=n):
    ans = max(np.sum(np.array(i)*(v-c)), ans)

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
import itertools
import numpy as np

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

v = np.array(v)
c = np.array(c)

ans = np.sum((v-c)*((v-c) >= 0))

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

#!/usr/bin/env python3
n = int(input())
a = [int(x) for x in input().split()]

ans = [
    sum(a[(i + j) % n] * (-1) ** (j % 2)
        for j in range(n))
    for i in range(n)
]

print(" ".join(str(x) for x in ans))


### FIXED CODE ###

#!/usr/bin/env python3
n = int(input())
a = [int(x) for x in input().split()]

v = sum(a[i] * (-1) ** (i % 2) for i in range(n))

ans = [0] * n

for i in range(n):
    ans[i] = v
    v = -v + 2 * a[i]

print(" ".join(str(x) for x in ans))
### BUGGY CODE ###

import numpy as np
n, x, y = map(int, input().split())
g = np.zeros((n+1,n+1),dtype=np.int64)
ans = np.zeros((n+1),dtype=np.int64)
for i in range(1,n+1):
    for j in range(i+1,n+1):
        if j <= x:
            g[i][j] = g[i][j - 1] + 1
        elif j > x and j <= y:
            #print(i,j,g[i][x] + j - x , g[i][x] + y - j + 1)
            if i <= x:
                g[i][j] = min(g[i][x] + j - x , g[i][x] + y - j + 1)
            else:
                g[i][j] = min(g[i][j - 1] + 1 , i - x + 1 + y - j)
        else:
            g[i][j] = g[i][j - 1] + 1

        ans[g[i][j]] += 1
#for i in range(1,n+1):
#    print(g[i,1:])

for i in range(1,n):
    print(ans[i])

### FIXED CODE ###

import numpy as np
n, x, y = map(int, input().split())

ans = [0] * n
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[min(j-i,abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(x-j))] += 1

for i in range(1,n):
    print(ans[i])
### BUGGY CODE ###

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

l = abs(N - M)

def factorial(n):
    m = 1
    for i in range(2, n+1):
        m *= i
    return m


# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:

    if N < M:
        _n = factorial(N)
        _m = _n * (M)
        ans = _n * _m
        print(ans)
        exit()

    else:
        _m = factorial(M)
        _n = _m * (N)
        ans = _n * _m
        print(ans)
        exit()



_n = factorial(N)
# _m = factorial(M)

ans = (_n * _n * 2) % (10**9+7)
print(ans)






### FIXED CODE ###

import math

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

l = abs(N - M)

# 列を作れないとき
if l >= 2:
    print(0)
    exit()

if l == 1:

    if N < M:
        _n = math.factorial(N)
        _m = _n * (M)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()

    else:
        _m = math.factorial(M)
        _n = _m * (N)
        ans = _n * _m
        print(ans%(10**9+7))
        exit()



_n = math.factorial(N)
# _m = factorial(M)

ans = (_n * _n * 2) % (10**9+7)
print(ans)
### BUGGY CODE ###

import itertools
n = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n[0])]

c = n[0]
d = n[1]

e = [0+i for i in range(c)]
f = list(itertools.combinations(e, d))

ans = []
for i in f:
    x, y, z = (0, 0, 0)
    for j in i:
        g = a[j]
        x, y, z = (x + g[0], y + g[1], z + g[2])
    ans.append(sum([abs(x), abs(y), abs(z)]))

print(max(ans))

### FIXED CODE ###

n = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n[0])]

c = n[0]
d = n[1]
e = [1, -1]
f = []
for i in e:
    for j in e:
        for k in e:
         f.append([i,j,k])

ans = []
for i in f:
    g = []
    for j in a:
        g.append(sum([j[k]*i[k] for k in range(3)]))
    g.sort()
    g.reverse()
    ans.append(sum(g[:d]))

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

import sys
import numpy as np


def main():
    f = sys.stdin.buffer
    N, K = map(int, f.readline().split())
    H = list(map(int, f.readline().split()))
    dp = [0] * N
    for i in range(1, N):
        dp[i] = min(
            dp[i - k - 1] + abs(H[i] - H[i - k - 1]) for k in range(K) if i - k - 1 >= 0
        )
    print(dp[-1])


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

# import numpy as np


def main():
    f = sys.stdin.buffer
    N, K = map(int, f.readline().split())
    H = list(map(int, f.readline().split()))
    dp = [0] * N
    for i in range(1, N):
        dp[i] = min(
            dp[i - k - 1] + abs(H[i] - H[i - k - 1]) for k in range(K) if i - k - 1 >= 0
        )
    print(dp[-1])


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

import numpy as np

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

S = input()
cumurative_sum_lst = np.zeros(N+1)
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        cumurative_sum_lst[i+1:] += 1

outputs = []
for i in range(Q):
    l, r = map(int, input().split())
    l, r = l - 1, r - 1

    tmp = cumurative_sum_lst[r] - cumurative_sum_lst[l]
    outputs.append(int(tmp))

for i in outputs:
    print(i)



### FIXED CODE ###


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

S = input()
cumurative_sum_lst = [0]*(N+1)
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        cumurative_sum_lst[i+1] = cumurative_sum_lst[i] + 1
    else:
        cumurative_sum_lst[i+1] = cumurative_sum_lst[i]

outputs = []
for i in range(Q):
    l, r = map(int, input().split())
    l, r = l - 1, r - 1

    tmp = cumurative_sum_lst[r] - cumurative_sum_lst[l]
    outputs.append(int(tmp))

for i in outputs:
    print(i)
### BUGGY CODE ###

N, M = map(int, input().split())
P = []
Y = []
D = {}
for i in range(M):
    p, y = map(int, input().split())
    P.append(p)
    Y.append(y)
    if p not in D:
        D[p] = [(i, y)]
    else:
        D[p].append((i, y))

for p in P:
    D[p].sort(key=lambda p: p[1])

ans = []
for p, pairs in D.items():
    for x, pair in enumerate(pairs):
        x += 1
        i = pair[0]
        y = pair[1]
        out = "{0:06d}{1:06d}".format(p, x)
        ans.append((i, out))
ans.sort(key=lambda p: p[0])
for an in ans:
    print(an[1])


### FIXED CODE ###

N, M = map(int, input().split())
D = {}
for i in range(M):
    p, y = map(int, input().split())
    if p not in D:
        D[p] = [(i, y)]
    else:
        D[p].append((i, y))

for p in D.keys():
    D[p].sort(key=lambda p: p[1])

ans = [None for i in range(M)]
for p, pairs in D.items():
    for x, pair in enumerate(pairs):
        x += 1
        i = pair[0]
        y = pair[1]
        out = "{0:06d}{1:06d}".format(p, x)
        ans[i] = out
        # ans.append((i, out))
# ans.sort(key=lambda p: p[0])
for an in ans:
    print(an)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
if N == 2:
    print(abs(A[0] - A[1]))
    exit()

ans = []
for i in range(1, N-1):
    cards1 = A[:i]
    cards2 = A[i:]
    ans.append(abs(sum(cards1) - sum(cards2)))
print(min(ans))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = float('inf')
X = sum(A)
partial_sum = 0
for i in range(N-1):
    partial_sum += A[i]
    ans = min(ans, abs(X - 2 * partial_sum))
print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
xy=[list(map(int,input().split())) for i in range(n)]
x,y=[[xy[i][0],i] for i in range(n)],[[xy[i][1],i] for i in range(n)]
x.sort()
y.sort()
ans=10**18*4
for i1 in range(n):
    i1_sub=n-i1
    x_sub1=x[i1][0]
    for l1 in range(i1_sub,1,-1):
        x_sub2=x[i1+l1-1][0]
        for i2 in range(n):
            i2_sub=n-i2
            y_sub1=y[i2][0]
            for l2 in range(i2_sub,1,-1):
                y_sub2=y[i2+l2-1][0]
                z=[0]*n
                for i in range(n):
                    if x_sub1<=xy[i][0]<=x_sub2 and y_sub1<=xy[i][1]<=y_sub2:
                        z[i]=1
                if sum(z)>=k:
                    ans=min((x_sub2-x_sub1)*(y_sub2-y_sub1),ans)
                else:
                    break
print(ans)


### FIXED CODE ###

n,k=map(int,input().split())
x,y=[[0,0] for i in range(n)],[[0,0] for i in range(n)]
xy=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
    x_sub,y_sub=xy[i]
    x[i][0]=x_sub
    x[i][1]=i
    y[i][0]=y_sub
    y[i][1]=i
x.sort()
y.sort()
ans=(10**18)*5
for i1 in range(n):
    for l1 in range(n-i1,1,-1):
        for i2 in range(n):
            for l2 in range(n-i2,1,-1):
                x_sub1=x[i1][0]
                x_sub2=x[i1+l1-1][0]
                y_sub1=y[i2][0]
                y_sub2=y[i2+l2-1][0]
                z=[0]*n
                for i in range(n):
                    if x_sub1<=xy[i][0]<=x_sub2 and y_sub1<=xy[i][1]<=y_sub2:
                        z[i]=1
                if sum(z)>=k:
                    ans=min((x_sub2-x_sub1)*(y_sub2-y_sub1),ans)
                else:
                    break
print(ans)
### BUGGY CODE ###

n, m = (int(x) for x in input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)

for ticket in range(m):
    A[0] //= 2
    A.sort(reverse=True)

print(sum(A))


### FIXED CODE ###

import heapq

n, m = (int(x) for x in input().split())
A = [int(x) * (-1) for x in input().split()]
heapq.heapify(A)

for ticket in range(m):
    maxval = heapq.heappop(A) * (-1)
    heapq.heappush(A, (maxval//2)*(-1))

print(sum(A) * (-1))
### BUGGY CODE ###

n = int(input())
l = [int(input()) for i in range(n)]
d = {}

c = 1
for i in l:
    while True:
        if c not in d:
            d[c] = i
            break
        else:
            if i > d[c]:
                d[c] = i
                break
            else:
                c += 1             
    c = 1

print(len(d))

### FIXED CODE ###

import bisect
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(input())
now = [-A[0]]
 
for i in range(1, N):
 
    index = bisect.bisect_right(now, -A[i])
    if index == len(now):
        now.append(-A[i])
    else:
        now[index] = -A[i]
print(len(now))
### BUGGY CODE ###

N,M=map(int, input().split())
A=list(map(int, input().split()))
A.index(max(A))
for i in range(M):
    A[A.index(max(A))]=A[A.index(max(A))]//2
print(sum(A))

### FIXED CODE ###

import heapq

N,M = map(int, input().split())
A = list(-int(i) for i in input().split()) 

heapq.heapify(A)

for i in range(M):
    x=heapq.heappop(A)//(-2)
    heapq.heappush(A, -x)

print(-sum(A))
### BUGGY CODE ###

N, M = map(int, input().split())
teiki_1 = []
teiki_N = []
for _ in range(M):
    a, b = map(int, input().split())
    if a == 1 or b == 1:
        teiki_1.append(a if a != 1 else b)
    if a == N or b == N:
        teiki_N.append(a if a != N else b)
for num in sorted(teiki_1):
    if num in sorted(teiki_N):
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


### FIXED CODE ###

N, M = map(int, input().split())
teiki_1 = []
teiki_N = []
for _ in range(M):
    a, b = map(int, input().split())
    if a == 1 or b == 1:
        teiki_1.append(a if a != 1 else b)
    if a == N or b == N:
        teiki_N.append(a if a != N else b)
if len(set(teiki_1) & set(teiki_N)) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

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

def binary_search(arr, low, high, x):
    while low < high:
        mid = (low + high) // 2
        if arr[mid] < x: low = mid+1
        else: high = mid

    return low


def rec_binary_search(arr, l, r, x):
    if r-l <= 0:
        return l
    
    else:
        mid = (l + r) // 2
        if arr[mid] == x:
            return mid
    
        elif arr[mid] > x:
            return binary_search(arr, l, mid-1, x)

        else:
            return binary_search(arr, mid+1, r, x)

ll.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        c = ll[i] + ll[j]
        limit = binary_search(ll, j+1, n, c)
        ans += limit - j - 1

print(ans)

### FIXED CODE ###

n = int(input())
ll = list(map(int, input().split()))
from bisect import bisect_left

def binary_search(arr, low, high, x):
    while low < high:
        mid = (low + high) // 2
        if arr[mid] < x: low = mid+1
        else: high = mid

    return low


def rec_binary_search(arr, l, r, x):
    if r-l <= 0:
        return l
    
    else:
        mid = (l + r) // 2
        if arr[mid] == x:
            return mid
    
        elif arr[mid] > x:
            return binary_search(arr, l, mid-1, x)

        else:
            return binary_search(arr, mid+1, r, x)

ll.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        c = ll[i] + ll[j]
        limit = bisect_left(ll, c)
        ans += limit - j - 1

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

def calc(n, N, x):
    m, M = -1, -1
    L, R = 0, 10**18
    while L+1 < R:
        P = (L+R)//2
        if n <= x*P:
            R = P
        else:
            L = P
    if n <= x*R <= N:
        m = x*R
    L, R = 0, 10**18
    while L+1 < R:
        P = (L+R)//2
        if N < x*P:
            R = P
        else:
            L = P
    if n <= x*L <= N:
        M = x*L + (x-1)
    return m, M

def main():
    k = int(input())
    a = list(map(int, input().split()))
    f = True
    m, M = 2, 2
    for i in reversed(range(k)):
        m, M = calc(m, M, a[i])
        if m == -1 or M == -1:
            f = False
            break
    if f:
        print(m, M)
    else:
        print(-1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def calc(n, N, x):
    m, M = -1, -1
    L, R = 0, 10**13
    while L+1 < R:
        P = (L+R)//2
        if n <= x*P:
            R = P
        else:
            L = P
    if n <= x*R <= N:
        m = x*R
    L, R = 0, 10**13
    while L+1 < R:
        P = (L+R)//2
        if N < x*P:
            R = P
        else:
            L = P
    if n <= x*L <= N:
        M = x*L + (x-1)
    return m, M

def main():
    k = int(input())
    a = list(map(int, input().split()))
    f = True
    m, M = 2, 2
    for i in reversed(range(k)):
        m, M = calc(m, M, a[i])
        if m == -1 or M == -1:
            f = False
            break
    if f:
        print(m, M)
    else:
        print(-1)

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

# -*- coding: utf-8 -*-
# 整数の入力
masu_size = int(input())
# スペース区切りの整数の入力
takasa_L = list(map(int, input().split()))
# 文字列の入力

counter_L = []
for m in range(0,masu_size):
    #print(m)
    counter = 0

    for h in range(m,masu_size):
        now_h = takasa_L[h]
        try:
            next_h = takasa_L[h+1]
        except:
            counter_L.append(counter)
            break
        #print(now_h,next_h)
        if now_h >= next_h:
            counter += 1
        else:
            counter_L.append(counter)
            break

print(max(counter_L))

### FIXED CODE ###

import copy
n = int(input())
r_L = list(map(int,input().split()))
l_L = copy.deepcopy(r_L)
l_L.reverse()


r_ans,l_ans = 0,0
r_ans_L,l_ans_L = [],[]

for val in range(n-1):
    if r_L[val] >= r_L[val+1]:
        r_ans += 1
    else:
        r_ans_L.append(r_ans)
        r_ans = 0
    



l_ans_L.append(l_ans)
r_ans_L.append(r_ans)

print(max(max(l_ans_L),max(r_ans_L)))