Harryxun/stf_run huggingface dataset:
N = int(input())
D = list(map(int, input().split()))
if (D[0]!=0) or (0 in D[1:]):
  print(0)
else:
  mapping = dict()
  max_ = 0
  for n in D[1:]:
    if n in mapping:
      mapping[n]+=1
    else:
      mapping[n]=1
      if max_ < n :
        max_ = n
  ans=1
  for i in range(1,max_):
    ans *= mapping[i]**(mapping[i+1])
  print(ans)

### FIXED CODE ###

N = int(input())
D = list(map(int, input().split()))
if (D[0]!=0) or (0 in D[1:]):
  print(0)
else:
  mapping = dict()
  max_ = 0
  for n in D[1:]:
    if n in mapping:
      mapping[n]+=1
    else:
      mapping[n]=1
      if max_ < n :
        max_ = n
  ans=1
  for i in range(1,max_):
    if (i in mapping) and (i+1 in mapping):
      ans *= mapping[i]**(mapping[i+1])
    else:
      ans = 0
      break
  print(ans % 998244353)
a = int(input())
b = int(input())
c = int(input())
d = int(input())

num_listx = []
num_listy = []

for num in range(a,b + 1):
  if num >= a:
    num_listx.append(num)
for nums in range(c,d + 1):
  if nums >= c:
    num_listy.append(nums)
find_max = []
for i in range(len(num_listx)):
  find_max.append(num_listx[i] * num_listy[i])
print(max(find_max))


### FIXED CODE ###

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

ans = max(a*c,a*d,b*c,b*d)

print(ans)
s = input()

def get_sum(J, J3, I, L, L3, K):
    total1 = int(I * J3 + J * J3 / 3)%  (10 ** 9 + 7)
    total2 = int(K * L3 + L * L3 / 3)%  (10 ** 9 + 7)
    return total1 * total2

n_q = 0
n_c = 0
for i in range(len(s)):
    if s[i] == '?':
        n_q += 1
    elif s[i] == 'C':
        n_c += 1

n_q_right = [0]
n_a_right = [0]
n_c_right = [0]
for i in range(len(s) - 1):
    if s[i] == '?':
        n_q_right.append(n_q_right[-1] + 1)
        n_a_right.append(n_a_right[-1])
        n_c_right.append(n_c_right[-1])
    elif s[i] == 'A':
        n_q_right.append(n_q_right[-1])
        n_a_right.append(n_a_right[-1] + 1)
        n_c_right.append(n_c_right[-1])
    elif s[i] == 'C':
        n_q_right.append(n_q_right[-1])
        n_a_right.append(n_a_right[-1])
        n_c_right.append(n_c_right[-1] + 1)
    elif s[i] == 'B':
        n_q_right.append(n_q_right[-1])
        n_a_right.append(n_a_right[-1])
        n_c_right.append(n_c_right[-1])

total = 0
P3_right = 1
P3_left = 3 ** n_q
for i in range(len(s)):
    if s[i] == '?':
        P3_left /= 3
        _n_q_left = n_q - n_q_right[i] - 1
        _n_c_left = n_c - n_c_right[i]
        total += get_sum(n_q_right[i], P3_right, n_a_right[i], _n_q_left, P3_left, _n_c_left) %  (10 ** 9 + 7)
        P3_right = P3_right * 3  % (10 ** 9 + 7)
    elif s[i] == 'B':
        _n_q_left = n_q - n_q_right[i]
        _n_c_left = n_c - n_c_right[i]
        total += get_sum(n_q_right[i], P3_right, n_a_right[i], _n_q_left, P3_left, _n_c_left) %  (10 ** 9 + 7)



print(total % (10 ** 9 + 7))


### FIXED CODE ###

s = input()
a, d = [0], [0]
for char in s[:-1]:
    if char == 'A':
        a.append(a[-1] + 1)
    else:
        a.append(a[-1])
    if char == '?':
        d.append(d[-1] + 1)
    else:
        d.append(d[-1])

c, e = [0], [0]
for char in s[::-1][:-1]:
    if char == 'C':
        c.append(c[-1] + 1)
    else:
        c.append(c[-1])
    if char == '?':
        e.append(e[-1] + 1)
    else:
        e.append(e[-1])
c = c[::-1]
e = e[::-1]

ret = 0
mod = 10 ** 9 + 7
for char, aa, dd, cc, ee in zip(s, a, d, c, e):
    if char in 'B?':
        tmp1 = aa * pow(3, dd, mod)
        if dd != 0:
            tmp1 += dd * pow(3, dd - 1, mod)

        tmp2 = cc * pow(3, ee, mod)
        if ee != 0:
            tmp2 += ee * pow(3, ee - 1, mod)

        ret += tmp1 * tmp2
        ret %= mod

print(ret)
s=input()
flag=True
n=len(s)
if s!=reversed(s):
    flag=False
if s[:(n-1)/2]!=reversed(s[:(n-1)/2]):
    flag=False
if s[(n+3)/2-1:]!=reversed(s[(n+3)/2-1::-1]):
    flag=False
print("Yes" if flag else "No")


### FIXED CODE ###


s=input()
flag=True
n=len(s)
if s!=s[::-1]:
    flag=False
if s[:(n-1)//2]!="".join(list(reversed(s[:(n-1)//2]))):
    flag=False
if s[(n+3)//2-1:]!="".join(list(reversed(s[(n+3)//2-1:]))):
    flag=False
print("Yes" if flag else "No")
import sys

def gcd(a,b):
	if b == 0:
		return a
	else:
		return gcd(b,a%b)

def lcm(a,b):
	return a*b/gcd(a,b)

for s in sys.stdin:
	i = map(int,raw_input().split())
	print gcd(*i), lcm(*i)

### FIXED CODE ###

import sys

def gcd(a,b):
	if b == 0:
		return a
	else:
		return gcd(b,a%b)

def lcm(a,b):
	return a*b/gcd(a,b)

for s in sys.stdin:
	i = map(int,s.split())
	print gcd(*i), lcm(*i)
n = int(input())

arr = list(map(int, input().strip().split()))

ma = arr[0]
cnt = 1

for i in range(1,n):
  	if arr[i] >= ma:
      	cnt += 1
	ma = max(ma, arr[i])
    
print (ans)


### FIXED CODE ###

n = int(input())

arr = list(map(int, input().strip().split()))

ma = arr[0]
cnt = 1

for i in range(1,n):
	if arr[i] >= ma:
		cnt += 1

	ma = max(ma, arr[i])

print (cnt)
N = int(input().split()[0])
h_list = list(map(int, input().split()))

tentou_list = []

for i in range(N-1):
    if h_list[i] >= h_list[i+1]:
        t = 1
    else:
        t = 0
    tentou_list.append(t)

# 一番長い1はどれか
c = 0
c_list = []

for t in tentou_list:
    if t == 0:
        c_list.append(c)
        c = 0
    else:
        c += 1

if t == 1:
    c_list.append(c)

ans = max(c_list)
print(ans)


### FIXED CODE ###

N = int(input().split()[0])
h_list = list(map(int, input().split()))

tentou_list = []

for i in range(N-1):
    if h_list[i] >= h_list[i+1]:
        t = 1
    else:
        t = 0
    tentou_list.append(t)

# 一番長い1はどれか
c = 0
c_list = []

for t in tentou_list:
    if t == 0:
        c_list.append(c)
        c = 0
    else:
        c += 1

if tentou_list:
    if t == 1:
        c_list.append(c)
    ans = max(c_list)
else:
    ans = 0

print(ans)
import math
A, B, C, D = map(int,input().split())

E = C*D / math.gcd(C, D)

Anum = A-1 - (int((A-1)/C) + int((A-1)/D) - int((A-1)/E))
Bnum = B - (int(B/C) + int(B/D) - int(B/E))

print(Bnum - Anum)

### FIXED CODE ###

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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

lcm = int(C*D / gcd(C, D))

def func(x):
    return x - int(x//C) - int(x//D) + int(x//lcm)

print(func(B) - func(A-1))
def main():
    N = int(input())
    S = input()
    if N % 2 == 1:
        print("No")
        quit()
    yesno = "Yes" if S[:N / 2] == S[N / 2:] else "No"
    print(yesno)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N = int(input())
    S = input()
    if N % 2 == 1:
        print("No")
        quit()
    n = N // 2
    yesno = "Yes" if S[:n] == S[n:] else "No"
    print(yesno)


if __name__ == "__main__":
    main()
H, W, m = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(m)]

mat = [[0] * W for _ in range(H)]
for h, w in hw:
    mat[h - 1][w - 1] = 1

rowcnt = [sum(row) for row in mat]
colcnt = [sum(row[col] for row in mat) for col in range(W)]

rowmax, colmax = max(rowcnt), max(colcnt)
for r, mat_h in zip(rowcnt, mat):
    for c, mat_hw in zip(colcnt, mat_h):
        if r == rowmax and c == colmax and mat_hw == 0:
            print(rowmax + colmax)
            exit()
print(rowmax + colmax - 1)


### FIXED CODE ###

H, W, m = map(int, input().split())
hw = [list(map(int, input().split())) for _ in range(m)]

row, col = [0] * H, [0] * W
for h, w in hw:
    row[h - 1] += 1
    col[w - 1] += 1

rowmax, colmax = max(row), max(col)
cnt = row.count(rowmax) * col.count(colmax)
for h, w in hw:
    if row[h - 1] == rowmax and col[w - 1] == colmax:
        cnt -= 1
print(rowmax + colmax - (cnt == 0))
N, H = map(int, input().split())
A = []
B = []

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
A = A[::-1]
a_max = A[0]

B.sort()
B = B[::-1]

attack = 0
idx = 0

while B[idx] > a_max:
    H -= B[idx]
    attack += 1
    idx += 1
    if H <= 0:
        print(attack)
        break

if H > 0:
    attack += (H // a_max) + 1
    print(attack)

### FIXED CODE ###

import math

N, H = map(int, input().split())
A = []
B = []

for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

a_max = max(A)

B = sorted([x for x in B if x > a_max], reverse = True)

attack = 0

for damage in B:
    H -= damage
    attack += 1
    if H <= 0:
        break

if H > 0:
    attack += math.ceil(H / a_max)

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

def calc():
    dp = [[0] * n for _ in range(n)]
    for i in range(n):
        dp[i][i] = a[i]

    for i in range(n - 2, -1, -1):
        for j in range(i + 1, n):
            dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1])

dp = calc()
print(dp[0][n - 1])

### FIXED CODE ###

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

for i in range(n - 2, -1, -1):
    for j in range(i + 1, n):
        dp[i][j] = max(a[i] - dp[i + 1][j], a[j] - dp[i][j - 1])

print(dp[0][n - 1])
K = int(input())

min_r = 0
max_r = 12

def count(idx, n):
    if idx==0:
        return 1
    if n==0:
        return count(idx-1, 1)+count(idx-1, 0)
    elif n==9:
        return count(idx-1, 9)+count(idx-1, 8)
    else:
        return count(idx-1, n-1)+count(idx-1, n)+count(idx-1, n+1)

lists = []
def count_2(idx, n, list_b):
    lis = list_b[:]
    lis.append(str(n))
    if idx==0:
        lists.append(int(''.join(lis)))
        return 1
    if n==0:
        count_2(idx-1, 1, lis)
        count_2(idx-1, 0, lis)
    elif n==9:
        count_2(idx-1, 9, lis)
        count_2(idx-1, 8, lis)
    else:
        count_2(idx-1, n-1, lis)
        count_2(idx-1, n, lis)
        count_2(idx-1, n+1, lis)

d = 0
now = 0
while 1:
    p = sum([count(d, i) for i in range(1, 10)])
    now += p
    if now>K:
        now -= p
        break
    d += 1

sump = 0
for i in range(1, 10):
    sump_old = sump
    sump += count(d, i)
    if sump+now>K:
        break
count_2(d, i, [])
print(lists[K-now-sump_old+1])

### FIXED CODE ###

K = int(input())

def count(idx, n):
    if idx==0:
        return 1
    if n==0:
        return count(idx-1, 1)+count(idx-1, 0)
    elif n==9:
        return count(idx-1, 9)+count(idx-1, 8)
    else:
        return count(idx-1, n-1)+count(idx-1, n)+count(idx-1, n+1)

lists = []
def count_2(idx, n, list_b):
    lis = list_b[:]
    lis.append(str(n))
    if idx==0:
        lists.append(int(''.join(lis)))
        return 1
    if n==0:
        count_2(idx-1, 1, lis)
        count_2(idx-1, 0, lis)
    elif n==9:
        count_2(idx-1, 9, lis)
        count_2(idx-1, 8, lis)
    else:
        count_2(idx-1, n-1, lis)
        count_2(idx-1, n, lis)
        count_2(idx-1, n+1, lis)

d = 0
now = 0
while 1:
    p = sum([count(d, i) for i in range(1, 10)])
    now += p
    if now>K:
        now -= p
        break
    d += 1

sump = 0
for i in range(1, 10):
    sump_old = sump
    sump += count(d, i)
    if sump+now>=K:
        break
count_2(d, i, [])
lists.sort()
if K<10:
    print(K)
else:
    print(lists[K-now-sump_old-1])
N, T = [int(i) for i in input().split()]


min_cost = 1001
for c, t in [input().split() for _ in range(N)]
    c, t = int(c), int(t)
    if t > T:
        continue
    min_cost = min(min_cost, c)

ans = min_cost if min_cost < 1001 else "TLE"
print(ans)

### FIXED CODE ###

N, T = [int(i) for i in input().split()]


min_cost = 1001
for c, t in [input().split() for _ in range(N)]:
    c, t = int(c), int(t)
    if t > T:
        continue
    min_cost = min(min_cost, c)

ans = min_cost if min_cost < 1001 else "TLE"
print(ans)
# -*- coding: utf-8 -*-
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if sum(A)+sum(B) <= K:
    print(N+M)
    exit(0)

sum_A = [0 for i in range(N+1)]
sum_B = [0 for i in range(M+1)]
for i in range(N):
    sum_A[i+1] = sum_A[i]+A[i]
for i in range(M):
    sum_B[i+1] = sum_B[i]+B[i]    

for l in range(N+M+1):
    min_time_l = min(
        [sum_A[i]+sum_B[l-i] 
        for i in range(max(l-M,0), N+1)])
    if min_time_l > K:
        print(l-1)
        exit(0)

print(N+M)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


sum_A = [0]
sum_B = [0]
for n in range(N):
    sum_A.append(sum_A[n]+A[n])
for m in range(M):
    sum_B.append(sum_B[m]+B[m])

max_j = M
max_book = 0
for i in range(N+1):
    # Aの机でi冊読んだときのBの机で読む最大値
    if sum_A[i] > K:
        break
    for j in range(max_j,-1,-1):
        if sum_A[i]+sum_B[j] <= K:
            max_j = j
            break
    else:
        max_j = 0
    
    max_book = max(max_book, i+max_j)

print(max_book)
a = input('x')
b = int('a')
c = b**3
print c

### FIXED CODE ###

int = int(input())

print(int**3)
S,W = input()
if S > W: print(safe)
else: print(unsafe)

### FIXED CODE ###

S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")
import numpy as np
while True:
    n= int(input())
   if n == 0:
        break
    a=map(int, input().split())
    print(np.std(a)

### FIXED CODE ###

while True:
    n = int( input() )
    if n==0:
        break
    a=list(map(int, input().split()))
    m=sum(a)/n
    s=0
    for i in a:
        s+=(i-m)**2
    print( ( s/n)**0.5 )
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    import numpy as np
    n=int(input())
    l=[list(map(int,input().split()))]
    lkyori=[]
    for i in range(n):
        for j in range(i+1,n+1):
            a=np.array(l[i])
            b=np.array(l[j])
            lkyori.append(np.linalg.norm(a-b)/n)
    import itertools
    answer=0
    print(list(itertools.permutations(lkyori,2)))

resolve()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=[list(map(int,input().split())) for i in range(n)]
    import itertools
    ans=0
    p=list(itertools.permutations(l))
    for x in p:
        z = list(x)
        for y in range(n-1):
            ans+=((z[y][0]-z[y+1][0])**2+(z[y][1]-z[y+1][1])**2)**0.5
    print(ans/len(list(p)))
resolve()
n = int(input())
go = [[]for _ in range(n)]
ge = [[]for _ in range(n)]

for _ in range(n-1):
    x,y,z = map(int, input().split())
    if z % 2 == 0:
        ge[x-1].append(y-1)
        ge[y-1].append(x-1)
    else:
        go[x-1].append(y-1)
        go[y-1].append(x-1)

color = [0] * n

def dfs(v, c):
    color[v] = c
    for i in range(len(go[v])):
        if color[go[v][i]] == 0:
            dfs(go[v][i], -c)
    for i in range(len(ge[v])):
        if color[ge[v][i]] == 0:
            dfs(ge[v][i], c)

dfs(0, 1)

for i in range(n):
    if color[i] == -1:
        print(0)
    else:
        print(1)

### FIXED CODE ###

import queue

n = int(input())
go = [[]for _ in range(n)]
ge = [[]for _ in range(n)]
 
for _ in range(n-1):
    x,y,z = map(int, input().split())
    if z % 2 == 0:
        ge[x-1].append(y-1)
        ge[y-1].append(x-1)
    else:
        go[x-1].append(y-1)
        go[y-1].append(x-1)

color = [0] * n
color[0] = 1

q = queue.Queue()

q.put(0)

while not q.empty():
    v = q.get()
    for i in range(len(go[v])):
        if color[go[v][i]] == 0:
            color[go[v][i]] = - color[v]
            q.put(go[v][i])
    for i in range(len(ge[v])):
        if color[ge[v][i]] == 0:
            color[ge[v][i]] = color[v]
            q.put(ge[v][i])

for i in range(n):
    if color[i] == -1:
        print(0)
    else:
        print(1)
from itertools import accumulate
N,K = map(int,input().split(" "))
p = list(map(int,input().split(" ")))
pp = list(accumulate(p))
ans = 0
for i in range(len(pp)):
    ans = max(ans,(pp[i+K]-pp[i]+K)/2)
print(ans)

### FIXED CODE ###

from itertools import accumulate
N,K = map(int,input().split(" "))
p = list(map(int,input().split(" ")))
pp = list(accumulate(p))
ans = (pp[K-1]+K)/2
for i in range(N-K):
    ans = max(ans,(pp[i+K]-pp[i]+K)/2)
print(ans)
N, M = map(int,input().split())
List_A = list(map(int,input().split()))
List_BC = [list(map(int,input().split())) for i in range(M)]

List_A.sort()
List_BC.sort(key=lambda x:x[1], reverse=True)
flag = 0
k = 0

for i in range(M):
    for j in range(List_BC[i][0]):
        if List_BC[i][1] > List_A[k]:
            List_A[k] = List_BC[i][1]
            k += 1
        else:
            flag = 1
            break
    if flag == 1:
        break

tmp = 0
for i in range(N):
    tmp += List_A[i]
    
print("{}".format(tmp))

### FIXED CODE ###

N, M = map(int,input().split())
List_A = list(map(int,input().split()))
List_BC = [list(map(int,input().split())) for i in range(M)]

List_A.sort()
List_BC.sort(key=lambda x:x[1], reverse=True)
flag = 0
k = 0

for i in range(M):
    for j in range(List_BC[i][0]):
        if k >= N:
            flag = 1
            break
        elif List_BC[i][1] > List_A[k]:
            List_A[k] = List_BC[i][1]
            k += 1
        else:
            flag = 1
            break
    if flag == 1:
        break

tmp = 0
for i in range(N):
    tmp += List_A[i]
    
print("{}".format(tmp))
line = input()
str = list(line)
ans = []
c = 0

for i in str:
    if (i == "1") or (i == "0"):
        ans.append(i)
    elif i == "B":
        if c != 0:
            c -= 1
            del ans[c]
            c -= 1
    c += 1

for i in ans:
    print("".join(i), end = '')

### FIXED CODE ###

line = input()
str = list(line)
ans = []
c = 0

for i in str:
    if (i == "1") or (i == "0"):
        ans.append(i)
    elif i == "B":
        if c != 0:
            c -= 1
            del ans[c]
        c -= 1
    c += 1

for i in ans:
    print("".join(i), end = '')
a,b,c,d = map(int,input().split())
import math
gcdcd = c*d//math.gcd(c,d)
e = a-1
print( b - b//c - b//d + b//gcdcd - e + e//c + e//d - e//gcdcd)


### FIXED CODE ###

a,b,c,d = (map(int,input().split()))
import fractions
gcdcd = c*d//int(fractions.gcd(c,d))
e = a-1
print( b - b//c - b//d + b//gcdcd - e + e//c + e//d - e//gcdcd)
L = input()
print((L/3)**3)

### FIXED CODE ###

# coding: utf-8
L = int(input())
print((L/3)**3.0)
import math

N, K = map(int, input().split(" "))
A = list(map(int, input().split(" ")))

for i in range(min(math.ceil(math.log(N)+5), K)):
  B = [0] * N
  for n, A_n in enumerate(A):
    B_min = max(0, n-A_n)
    b_max = min(N-1, n+A_n)
    B[B_min] += 1
    if b_max+1 < N:
      B[b_max+1] -= 1
  
  sum = 0
  for n in range(len(A)):
    sum += B[n]
    A[n] = sum

print(" ".join(list(map(str, A))))

### FIXED CODE ###

S = input()
print(S[:3])
s=input()
print (s/3600 : s/60%60 : s%60)


### FIXED CODE ###

s=int(raw_input())
print "%d:%d:%d" %(s/3600,s/60%60,s%60)
import numpy as np

N = int(input())
S = []
for i in range(N):
  S.append(list(input()))

S = np.array(S)

s = list('abcdefghijklmnopqrstuvwxyz')

T = np.zeros([N, 26])

for i, a in enumerate(s):
  T[:, i] = np.sum(S == a, axis=1)

T3 = np.atleast_3d(T)
r = np.prod(T3 == T3.T, axis=1)

print((np.sum(r) - len(r)) // 2)

### FIXED CODE ###

def number(x):
  return int((1 + (1 + 8*x)**0.5) / 2)


N = int(input())
d = {}
for i in range(N):
  s = ''.join(sorted(input()))
  if s in d.keys():
    d[s] += number(d[s])
  else:
    d[s] = 0


print(sum(d.values()))
s=input()
for i in range(len(s)):
    for j in range(i,len(s)+1):
        if s[:i]+s[j]=="keyence":
            print("YES")
            exit()
print("NO")

### FIXED CODE ###

s = input()
for i in range(len(s)):
    for j in range(i, len(s)+1):
        if s[:i] + s[j:] == "keyence":
            print("YES")
            exit()
print("NO")
N, x = map(int,input().split())
X = list(map(int,input().split()))

X.append(x)
X.sort()

ans = X[1] - X[0]
for i in range(1, N+1):
    t = X[i+1] - X[i]
    if t < ans:
        ans = t
print(ans)

### FIXED CODE ###

N, X = map(int,input().split())
A = list(map(int,input().split()))

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

ans = abs(A[0]-X)
for a in A:
    ans = gcd(ans, abs(a-X))


print(ans)
n=int(input()
ans=0
dic={}
for _ in range(n):
    s=input()
    s=sorted(s)
    s=''.join(s)
    if not s in dic.keys():
      dic[s]=1
    else: dic[s]+=1
for i in dic.values():
  ans+=i*(i-1)//2


print(ans)


### FIXED CODE ###

n=int(input())
ans=0
dic={}
for _ in range(n):
    s=input()
    s=sorted(s)
    s=''.join(s)
    if not s in dic.keys():
      dic[s]=1
    else: dic[s]+=1
for i in dic.values():
  ans+=i*(i-1)//2


print(ans)
x=int(input())

if 400 <= x <= 599:
  print('8');
elif 600 <= x <= 799:
  print('7')
elif 800 <= x <= 999:
  print('6')
elif 1000 <= x <= 1199:
  print('5')
elif 1200 <= x <= 1399:
  print('4')
elif 1400 <= x <= 1599:
  rint('3')
elif 1600 <= x <= 1799:
  print('2')
else:
  print('1')

### FIXED CODE ###

x=int(input())

if 400 <= x <= 599:
  print('8');
elif 600 <= x <= 799:
  print('7')
elif 800 <= x <= 999:
  print('6')
elif 1000 <= x <= 1199:
  print('5')
elif 1200 <= x <= 1399:
  print('4')
elif 1400 <= x <= 1599:
  print('3')
elif 1600 <= x <= 1799:
  print('2')
else:
  print('1')
# 数値と符合を取得
A,op,B = map(str,input().split())

# 計算結果を出力
A = int(A)
op = sign(op)
B = int(B)
calc = int(A op B)
print(calc)

### FIXED CODE ###

# 数値と符号の取得
A,op,B = map(str,input().split())

# 計算して出力
calc = eval(A + op + B)
print(int(calc))
import math

n = int(input())
s = int(input())

r = 0

if n == s:
    print(n + 1)
    exit()

nn = int(math.sqrt(n)) + 1

for i in range(2, nn):
    nt = n
    st = 0

    while nt > 0:
        st += nt % i
        nt //= i

    if st == s:
        print(i)
        exit()
    
for i in range(nn, 0, -1):
    nt = n
    st = 0

    b = (n - s) // i + 1
    
    st = n % b + n // b

    if st == s:
        print(b)
        exit()

print(-1)

### FIXED CODE ###

import math

n = int(input())
s = int(input())


r = 0

if n == s:
    print(n + 1)
    exit()
elif n < s:
    print(-1)
    exit()

sq = int(math.sqrt(n))


# 2 <= d <= √n
for i in range(2, sq+1):
    nt = n
    st = 0

    while nt > 0:
        st += nt % i
        nt //= i

    if st == s:
        print(i)
        exit()
    
# √n < d <= n
for i in range(sq+1, 0, -1):
    b = (n - s) // i + 1
    
    st = n % b + n // b

    if n // b != b and st == s:
        print(b)
        exit()

print(-1)
#include<stdio.h>

int con(int a,int b){
    if(a>b){
       return b; 
    }else{
        return a;
    }
}

int main(void){
    int n;
    int count=0;
    int a[200000];
    int min=__INT_MAX__;

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

    for(int i=0;i<n;i++){
        min=con(min,a[i]);
        if(min==a[i]){
            count++;
        }
    }

    printf("%d",count);
}

### FIXED CODE ###

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


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

mi = 1000000000
cnt = 0
for i in range(n):
    if p[i] <= mi:
        cnt += 1
    if mi > p[i]:
        mi = p[i]

print(cnt)
def gcd(x, y):
    a = max(x, y)
    b = min(x, y)
    if b == 0:
        return a
    remainder = a % b
    if remainder == 0:
        return b
    return gcd(b, remainder)


N = int(input())
integers = [int(x) for x in input().split()]

left = [0]
right = [0]

for i in range(N):
    left.append(gcd(left[-1], integers[i]))
    right.append(gcd(right[-1], integers[-i-1]))

# left[0] = 0
# right[0] = 0
right.reverse()

lr = []
for i in range(N-1):
    lr.append(gcd(left[i+1], right[i+2]))

print(max(lr))


### FIXED CODE ###

def gcd(x, y):
    a = max(x, y)
    b = min(x, y)
    if b == 0:
        return a
    remainder = a % b
    if remainder == 0:
        return b
    return gcd(b, remainder)


N = int(input())
integers = [int(x) for x in input().split()]

left = [0]
right = [0]

for i in range(N):
    left.append(gcd(left[-1], integers[i]))
    right.append(gcd(right[-1], integers[-i-1]))

# right.reverse()

lr = []
for i in range(N):
    lr.append(gcd(left[i], right[-i-2]))

print(max(lr))