Harryxun/stf_run huggingface dataset:
x = input().split()
n = 0
for i in range(1,int(x[0])+1):
    l = 0
    for j in range(1,i+1):
               if x[i] <= x[j]:
                l += 1
    if l == i:
        n += 1
print(n)

### FIXED CODE ###

n = int(input())
m = list(map(int, input().split()))
l = 0
s = m[0]
for i in range(0,n):
    if s >= m[i]:
        s = m[i]
        l += 1
print(l)
h , w = (int(i) for i in input().split())
a =[]
dy = [0, 0, 1, -1]
dx = [1, -1, 0, 0]


for i in range(w):
    a.append(input())
    
f = True
def check(x,y):
    if a[x][y] =='.':
        return True
    for n in range(4):
        i = dx[n]
        j = dy[n]
        if 0 <= x+i < h and 0 <= y + j < w and a[x+i][y+j]=='#':
            #print(x+i,y+j)
            return True
        return False


f = True
for i in range(w):
    for j in range(h):
        l = check(i,j)
        if not(l) and f:
                print ("No")
                f = False
                
if(f):
    print("Yes")

### FIXED CODE ###

H ,W = [int(i) for i in input().split(' ')]
s = []
#print(s)
for i in range(H):
    line = input()
    lis = []
    for str in line:
        lis.append(str)
    s.append(lis)


def drawable(h,w):
    for i in [-1,1]:
        if 0 <= w+i < W:
#            print(h,w+i)
            if s[h][w+i] =='#':
                return True
    for i in [-1,1]:
        if 0 <= h+i < H:
            if s[h+i][w] =='#':
                return True

    return False

flag = True
for i in range(H):
    for j in range(W):
#        print(i,j)
        if s[i][j]=='#' and not(drawable(i,j)):
           flag = False 

if flag:
    print("Yes")
else:
    print("No")
S = str( input() )
listw = [ "Sunny", "Cloudy", "Rainy" ]
ind = listw.index( S )
print( listw.append( "Sunny" )[ind+1] ) 

### FIXED CODE ###

S = input()
listw = [ "Sunny", "Cloudy", "Rainy" ]
ind = listw.index( S )
if ind == 2 : 
   ind = -1
print( listw[ind+1] )
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = readline().rstrip()
    res = S[:]

    if '(' in S:
        idx = S.index('(')
        cnt = 1
        for s in S[idx+1:]:
            if s == '(':
                cnt += 1
            else:
                cnt -= 1
        res += ')' * max(cnt, 0)
    
    S = S[::-1]
    idx = S.index(')')
    cnt = 1
    for s in S[idx+1:]:
        if s == ')':
            cnt += 1
        else:
            cnt -= 1
    res = '(' * max(cnt, 0) + res

    print(res)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = readline().rstrip()
    res = S[:]

    pls_left = 0
    pointer = 0
    for s in S:
        if s == '(':
            pointer += 1
        else:
            if pointer == 0:
                pls_left += 1
            else:
                pointer -= 1

    pls_right = pointer
    res = '(' * pls_left + S
    res += ')' * pls_right

    print(res)

if __name__ == '__main__':
    main()
K, S = map(int, input().split())
answer = 0

for x in range(K+1):
  for y in range(K+1):
	if S - x - y <= K:
    	answer += 1
 
print(answer)

### FIXED CODE ###

K, S = map(int, input().split())
answer = 0

for x in range(K+1):
  for y in range(K+1):
    if S - x - y <= K and S -x-y >=0:
      answer += 1
 
print(answer)
N = int(input())

fizzbuzz = []

for i in range(1, N):
    if i % 15 == 0:
        fizzbuzz.append('0')
    elif i % 3 == 0:
        fizzbuzz.append('0')
    elif i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(int(sum(num))L)

### FIXED CODE ###



N = int(input())

fizzbuzz = []

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(sum(num))
n,k = map(int,input().split())	
li = list(map(int,input().split()))
dp = [0] + [float("inf")]*(n-1)
for i in range(1,n):
    for j in range(max(0, i-k),i):
        dp[i] = min(dp[i], dp[j] + abs(li[i-k] - li[i]))
print(dp[-1])

### FIXED CODE ###

n,k = map(int,input().split())	
li = tuple(map(int,input().split()))
dp = [0] + [float("inf")]*(n-1)
for i in range(1,n):
    for j in range(max(0, i-k),i):
        dp[i] = min(dp[i], dp[j] + abs(li[i] - li[j]))
print(dp[-1])
# coding: utf-8
a=input()
b=input()
m=int(a)+int(b)
if int(m)<10:
  print(int(m))
else:
  print("error")

### FIXED CODE ###

# coding: utf-8
a,b=input().split()
m=int(a)+int(b)
if m<10:
  print(int(m))
else:
  print("error")
a,b,c=map(int,input.split());print(["No","Yes"][a==b+c or b=a+c or c==a+b])

### FIXED CODE ###

a,b,c=map(int,input().split());print(["No","Yes"][(a+b==c)+(b+c==a)+(c+a==b)])
N = int(input())
numbers = [int(x) for x in input().split()]

numbers.sort()

# 最大値
n = numbers.pop()

# nCk を k < n の範囲で事前に計算する
memo = [0] * (n + 1)

# nC1 = n
memo[1] = n

for i in range(2, n):
  memo[i] = memo[i - 1] * (n - i + 1) // i

max_value = 0
max_at = 0

for i in numbers:
  if max_value < memo[i]:
    max_value = memo[i]
    max_at = i

print(n, max_at)        

### FIXED CODE ###

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

numbers.sort()

n = numbers.pop()
r = min(numbers, key=lambda x: abs(x - n / 2))  # N

print(n, r)
n,t=map(int,input().split())
cost_list=[]
for i in range(n):
  cost,time=map(int,input().split())
  if time<=t:
    cost_list+=[cost]
if cost_list!=[]:
  print(min(cost_list))
else:
  print(TLE)

### FIXED CODE ###

n,t=map(int,input().split())
cost_list=[]
for i in range(n):
  cost,time=map(int,input().split())
  if time<=t:
    cost_list+=[cost]
if cost_list!=[]:
  print(min(cost_list))
else:
  print("TLE")
k,n=map(int,input().split())
a=list(map(int,input().split()))
b=0
s=[0]*n
#間隔を求める
for i in range(n-1):
    s[i]=a[i+1]-a[i]
#間隔を足す
for i in range(n):
  if s[i]<k/3:
    b=b+s[i]
  else:
    con=k-s[i]
    print(con)
    exit()
  
print(b)

### FIXED CODE ###

s=input()
if s[2]==s[3] and s[4]==s[5]:
  print('Yes')
else:
  print('No')
x=int(input())
y=int(input())
Print(x*x-y)

### FIXED CODE ###

x=int(input())
y=int(input())
print(x**2-y)
N,M=map(int, raw_input().split())

par=[ i for i in range(N+1)  ]

def root(x):
	if par[x]==x:
		return x
	else:
		par[x]=root( par[x] )
		return par[x]

def same(x,y):
	return root(x)==root(y)

def unite(x,y):
	x=root(x)
	y=root(y)
	if x==y: return
	par[x]=y



for i in range(M):
	x,y,z=map(int, raw_input().split())
	if not same(x,y):
		unite(x,y)


S=set()
for i in range(1,N+1):
	S.add(root(i))

print len(S)



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N,M=map(int, raw_input().split())
par=[ i for i in range(N+1)  ]

def root(x):
	if par[x]==x:
		return x
	else:
		par[x]=root( par[x] )
		return par[x]

def same(x,y):
	return root(x)==root(y)

def unite(x,y):
	x=root(x)
	y=root(y)
	if x==y: return
	par[x]=y


for i in range(M):
	x,y,z=map(int, raw_input().split())
	unite(x,y)


S=set()
for i in range(1,N+1):
	S.add(root(i))

print len(S)
def main():
    N = int(input().strip())
    X_list = [int(i) for i in input().strip().split()]
    sorted_x = sorted(X_list)

    left = sorted_x[(N // 2)-1]
    right = sorted_x[N // 2]
    for x in X_list:
        if X_list[x-1] <= left:
            print(right)
        else:
            print(left)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N = int(input().strip())
    X_list = [int(i) for i in input().strip().split()]
    sorted_x = sorted(X_list)

    left = sorted_x[(N // 2)-1]
    right = sorted_x[N // 2]
    for x in X_list:
        if x <= left:
            print(right)
        else:
            print(left)


if __name__ == "__main__":
    main()
a, b, c = map(int, input().split())
 if a < b < c:
   print('Yes')
 elif a > b > c:
   print('No')
 else:
   print('none')

### FIXED CODE ###

a, b, c = map(int, input().split())
if a < b < c:
  print("Yes")
else:
  print("No")
n,l = map(int,input().split())
s = sort([input() for i in range(n)])
print(*s,sep="")

### FIXED CODE ###

N,L =input().split()
listA=[]
for i in range(int(N)):
    listA.append(input())

print(*sorted(listA),sep="")
S = input()
X, Y = map(int, input().split())

def run_length(s) -> list:
    res = [[s[0], 1]]
    for i in range(1, len(s)):
        if res[-1][0] == s[i]:
            res[-1][1] += 1
        else:
            res.append([s[i], 1])
    return res

RL = run_length(S)
if RL[0][0] == 'T':
    RL = [['F', 0]] + RL

SIZE = len(S)
nx = 1 << SIZE
ny = 1 << SIZE

x_flag = 1
for i in range(0, len(RL), 2):
    s, l = RL[i]
    if i == 0:
        nx = nx << l
    else:
        x_flag = (x_flag + RL[i - 1][1]) % 2
        if x_flag:
            nx = (nx << l) | (nx >> l)
        else:
            ny = (ny << l) | (ny >> l)

if ((nx >> (SIZE + X)) & 1) & ((ny >> (SIZE + Y)) & 1):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
X, Y = map(int, input().split())

SIZE = 10 ** 4

M = [0] if S[0] == "T" else []
for i in range(1, len(S)):
  if S[i] != S[i-1]:
    M.append(i)
M.append(len(S))
M = [0] + M
#print("M:", M)

L = []
for i in range(1, len(M)):
  L.append(M[i] - M[i - 1])
#print("L:", L)

for i in range(3, len(L), 2):
  L[i] += L[i - 2]
L = [0] + L
#print("L:", L)

x = 1 << SIZE
y = 1 << SIZE
#print("x:", bin(x)[2::])
#print("y:", bin(y)[2::])

for i in range(1, len(L), 2):
  dist = L[i]
  dirc = L[i - 1]
  #print("dist, dirc:", dist, dirc)
  if i == 1:
    x = x << dist
  else:
    if dirc % 2 == 0:
      x = (x << dist) | (x >> dist)
    else:
      y = (y << dist) | (y >> dist)
      
if (x >> SIZE + X) & 1 == 1 and (y >> SIZE + Y) & 1 == 1:
  print("Yes")
else:
  print("No")
import math

d, g = map(int, input().split())
ls = [[100 * (i + 1)] + list(map(int,
                                 input().split())) for i in range(d)][::-1]
l0 = [a * p + c for a, p, c in ls]

res = float('inf')
for index in range(2**d):
    cs = '{:0{d}b}'.format(int(cs))
    count = 0
    s = 0
    for i, c in enumerate(cs):
        if c == '1':
            count += ls[i][1]
            s += l0[i]
    if s < g:
        for i, c in enumerate(cs):
            if c == '0' and s + ls[i][0] * ls[i][1] >= g:
                n = math.ceil((g - s) / ls[i][0])
                count += n
                s += ls[i][0] * n
                break
    if s >= g:
        res = min(res, count)
print(res)

### FIXED CODE ###

import itertools
import math

d, g = map(int, input().split())
ls = [[100 * (i + 1)] + list(map(int, input().split())) for i in range(d)]
s0 = [a * p for a, p, _ in ls]
s1 = [a * p + c for a, p, c in ls]

res = float('inf')
for indices in itertools.permutations(range(d)):
    count = 0
    s = 0
    for i in indices:
        if s + s0[i] >= g:
            count += math.ceil((g - s) / (100 * (i + 1)))
            break
        else:
            count += ls[i][1]
            if count >= res:
                break
            s += s1[i]
            if s >= g:
                break
    res = min(res, count)
print(res)
import math
A,B = map(int, input().split())
print(int((A *B) / math.gcd(A, B)))

### FIXED CODE ###

from fractions import gcd
A,B = map(int, input().split())
print(int((A * B) / gcd(A, B)))
x, a, b,  = map(int, input().split())

sum_number = []

for i in range(x+1):
  if a <= sum(map(int, str(i))) <= b:
    sum_number += [i]
    
priny(sum(sum_number))
  
  


### FIXED CODE ###

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

sum_number = []

for i in range(x+1):
  if a <= sum(map(int, str(i))) <= b:
    sum_number += [i]
    
print(sum(sum_number))
print(input[:3]+"8"+input[6:])

### FIXED CODE ###

s=input()
s=s[:3]+"8"+s[4:]
print(s)
# Beginners Contest (C)

import sys

# 約数に分解
def calc_divisor(n, div_dic = None):
	if n == 1: return div_dic
	# 初回呼び出し時の初期化
	if div_dic is None: div_dic = {}
	for i in range(n):
		# 1を除く
		if (i+1) == 1: continue
		# 約数の場合
		if n%(i+1) == 0:
			if (i+1) not in div_dic: div_dic[i+1] = 0
			div_dic[i+1] += 1
			return calc_divisor(n//(i+1), div_dic)

# 入力取得
a,b = [int(e) for e in input().split(" ")]

# 約数に分解
div_dic_a = calc_divisor(a)
div_dic_b = calc_divisor(b)

# 約数の和集合を計算
div_ls = list(div_dic_a) + list(div_dic_b)
div_ls = list({k: 1 for k in div_ls})
div_dic = {k:div_dic_a[k] if div_dic_a.get(k,0) > div_dic_b.get(k,0) else div_dic_b[k] for k in div_ls}
# print(div_dic)

# 最小公約数を計算
ans = 1
for k in div_dic:
	ans *= k ** div_dic[k]

print(ans)


### FIXED CODE ###


# Beginners Contest (C)

import sys

# 約数に分解
def calc_divisor(n):
	div_dic = {}
	if n == 1: return div_dic
	k = 2
	while True:
		# 約数の場合
		if n%k == 0:
			if k not in div_dic: div_dic[k] = 0
			div_dic[k] += 1
			n = n//k
			if n == 1: break
		else:
			k += 1
	return div_dic

# 入力取得
a,b = [int(e) for e in input().split(" ")]

# 約数に分解
div_dic_a = calc_divisor(a)
div_dic_b = calc_divisor(b)

# 約数の和集合を計算
div_ls = list(div_dic_a) + list(div_dic_b)
div_ls = list({k: 1 for k in div_ls})
div_dic = {k:(div_dic_a[k]
	if div_dic_a.get(k,0) > div_dic_b.get(k,0)
	else div_dic_b[k]) for k in div_ls}
# print(div_dic)

# 最小公倍数を計算
ans = 1
for k in div_dic:
	ans *= k ** div_dic[k]

print(ans)
# coding: utf-8
import math

N, M = [int(s) for s in input().strip().split()]

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

ROOT_M = int(math.sqrt(M))
divisors = []
for d in range(1, ROOT_M+1):
    if M % d == 0:
        divisors.append(d)
        divisors.append(M//d)

divisors.sort()
MAX_VAL = int(M/N)
for d in divisors:
    if d > MAX_VAL:
        break
    max_gcd = d

print(max_gcd)


### FIXED CODE ###

# coding: utf-8

def main():
    N = int(input().strip())

    if N == 1:
        print("Hello World")
    else:
        A = int(input().strip())
        B = int(input().strip())
        print(A+B)


if __name__ == "__main__":
    main()
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    limit = t[0] + k
    bus = 0
    for i in range(n):
        if t[i] <= limit:
            bus += 1
            if bus == c:
                ans += 1
                bus = 0
                limit = t[i + 1] + k
        else:
            ans += 1
            bus = 1
            limit = t[i] + k
    if bus:
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()
input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for i in A):
    A = [a/2 for a in A]
    count += 1
print(count)



### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
count = 0
while True:
    for i in range(n):
        fin = True
        if a[i] % 2 == 0:
            a[i] = (a[i] / 2)
        else:
            fin = False
            break
    if fin:
        count += 1
    else:
        break
print(count)
data = [[1, "kogaku10gokan"]

n, q = map(int, raw_input().split())
for i in range(n):
    a, b = map(int, raw_input().split())
    data.append([a,b])

for i in data:
    if i[0] > q:
        print i[1]

### FIXED CODE ###

n,q = map(int,raw_input().split())
old = "kogakubu10gokan"
for i in range(n):
	year,new = map(str,raw_input().split())
	if int(year) >= q:
		print new if int(year) == q else old
		break
	old = new
else:
	print old
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    # a = [list(map(lambda x: int(x) % 2 == 1, input().strip().split(" "))) for _i in range(h)]
    a = [list(map(lambda x: int(x) % 2 == 1, _i.split(" "))) for _i in ins[1:]]
    move = []
    for i in range(h):
        for j in range(w):
            if not a[i][j]:
                continue
            if j < w - 1:
                a[i][j + 1] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 1, j + 2))
            elif i < h - 1:
                a[i + 1][j] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 2, j + 1))
    move.insert(0, str(len(move)))
    return "\n".join(move)


if __name__ == '__main__':
    line = input().strip()
    tmp = [line]
    for _ in range(int(line[0])):
        tmp.append(input().strip())
    print(solve('\n'.join(tmp)))
    # print(solve(line))


### FIXED CODE ###

h,w = map(int,input().split())
a = []
for i in range(h):
    tmp = list(map(lambda x:int(x)%2,input().split()))
    a.append(tmp)
result = []
 
for i in range(h):
    for j in range(w-1):
        if a[i][j] == 1:
            #a[i][j] == 0
            a[i][j+1] = 1 ^ a[i][j+1]
            result.append((i+1,j+1,i+1,j+2)) 
for i in range(h-1):
    if a[i][w-1] == 1:
        a[i+1][w-1] = 1 ^ a[i+1][w-1]
        result.append((i+1,w,i+2,w))
print(len(result))
for row in result:
    print("{} {} {} {}".format(row[0],row[1],row[2],row[3]))
n = int(input())
dict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
for _ in range(n):
    s = input()
    if s in dict:
        dict[s] = dict[s] + 1
for k, l  in dict.items():
    print(k + ' x ' + str(l))



### FIXED CODE ###

n = (input())
x, y = divmod(int(n), 1000)
if y == 0:
    print(0)
else:
    ans = (1000 * (x + 1)) - int(n)
    print(ans)
from sys import stdin
stdin = open("input.txt")

if __name__ == "__main__":
  N = int(stdin.readline())
  S = stdin.readline().rstrip()
  
  print(S.count("ABC"))

### FIXED CODE ###

from sys import stdin
#stdin = open("input.txt")

if __name__ == "__main__":
  N = int(stdin.readline())
  S = stdin.readline().rstrip()
  
  print(S.count("ABC"))
n = int(input())
s = [input() for i in range(n)]

ab = 0
ba = 0
c2 = 0
c3 = 0
for x in s:
    if 'AB' in x:
        ab += x.count('AB')    
    if x[-1] == 'A' and x[0] == 'B':
        ba = 1
    if x[-1] == 'A' and x[0] != 'B':
        c2 += 1
    if x[-1] != 'A' and x[0] == 'B':
        c3 += 1
if ba > 0:
    if c2 + c3 > 0:
        ans = ab + ba + min(c2, c3)
    else: # c2 = c3 =0
        ans = ab + ba - 1
print(ans)


### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]

ab = 0
ba = 0
c2 = 0
c3 = 0
for x in s:
    if 'AB' in x:
        ab += x.count('AB')    
    if x[-1] == 'A' and x[0] == 'B':
        ba += 1
    if x[-1] == 'A' and x[0] != 'B':
        c2 += 1
    if x[-1] != 'A' and x[0] == 'B':
        c3 += 1
if ba > 0:
    if c2 + c3 > 0:
        ans = ab + ba + min(c2, c3)
    else: # c2 = c3 =0
        ans = ab + ba - 1
else:
    ans = ab + min(c2, c3)
print(ans)
X,K,D=list(map(int,input().split()))
memo=[]
def dfs(i,X):
    if i==K:
        memo.append(abs(X))
        return False
    
    if dfs(i+1,X+D):
        return True

    if dfs(i+1,X-D):
        return True

def solve():
    while dfs(0,X)!=False:
        print(min(memo))
        break

if __name__=='__main__':
    solve()


### FIXED CODE ###

X,K,D=list(map(int,input().split()))
 
def sgn(x):
    if x>0:
        return 1
    elif x<0:
        return -1
    return 0
 
def solve():
    if X>0:
        x_greedy=X-K*D
    else:
        x_greedy=X+K*D
 
    if sgn(X)==sgn(x_greedy):
        return print(abs(x_greedy))
 
    else:
        x_r=X%D
        x_l=x_r-D
 
        r_parity=(abs(X-x_r)//D)%2
        if K%2==r_parity:
            return print(abs(x_r))
        else:
            return print(abs(x_l))
 
if __name__=='__main__':
    solve()
N = input()
a = list(map(input(),range(1,N+1)))
i = 0
for x in a:
	if x%2!=0 and a[x]%2!=0:
    	i+==1
     
    print(i)


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
i=0
for x,y in enumerate (a):
    b=x+1
    if b%2!=0 and y%2!=0:
        i+=1
print(i)
以下ペースト可
# start 21:14
a, b = [int(item) for item in input().split()]

if b > a:
    c = a
    a = b
    b = c


# 最大公約数を求める
def gcd(a, b):
    while b > 1:
        a, b = b, a%b
    return a

# 公約数でかつ素数の_listを求める
prime_devisor_list = [1]

import math

def is_prime(num):
    if num in [1, 2]:
        return True
    else:
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                return False
        return True

for i in range(2, gcd(a, b)+1):
    if a % i == 0 and b % i == 0:
        # i can be ans
        # check pirme

        if is_prime(i):
            prime_devisor_list.append(i)

# 数をこたえる
print(len(prime_devisor_list))


### FIXED CODE ###

# start 21:14
a, b = [int(item) for item in input().split()]

# 素因数リスト
import math
def factor(num):
    divisor_list = [1]
    divisor = 2
    max_prime = int(math.sqrt(num))
    while max_prime >= divisor:
        if num % divisor == 0:
            divisor_list.append(divisor)
            num //= divisor

        else:
            divisor += 1
    divisor_list.append(num)
    return divisor_list

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

cd_list = set(factor(gcd(a, b)))

print(len(cd_list))
n=int(input())
p=list(map(int, input().split()))
ans=list(range(n) + 1)

ans_mix=[]
is_possible = False

if p==ans:
    is_possible = True

for i in range(0, n-1):
    for j in range(1, n):
        a=ans.copy()
        tmp=a[i]
        a[i]=a[j]
        a[j]=tmp
        if a==p:
            is_possible = True

if is_possible:
    print('YES')
else:
    print('NO')



### FIXED CODE ###

n=int(input())
p=list(map(int, input().split()))
ans=list(range(1,n+1))

ans_mix=[]
is_possible = False

if p==ans:
    is_possible = True

for i in range(0, n-1):
    for j in range(1, n):
        a=ans.copy()
        tmp=a[i]
        a[i]=a[j]
        a[j]=tmp
        if a==p:
            is_possible = True

if is_possible:
    print('YES')
else:
    print('NO')
# -*- coding: utf-8 -*-
def stairs_count(now, goal, memo):
    if now == goal:
        return 1
    if now > goal:
        return 0

    if memo[now] != -1:
        return memo[now]

    step1 = 0
    step2 = 0

    # step1
    if now + 1 == goal:
        step1 = 1
    else:
        step1 = stairs_count(now+1, goal, memo)

    # step2
    if now + 2 > goal:
        step2 = 0
    elif now + 2 == goal:
        step2 = 1
    else:
        step2 = stairs_count(now+2, goal, memo)

    memo[now] = (step1 + step2) % 1000000007
    return memo[now]


n, m  = map(int, input().split())
memo = [-1 for _ in range(n)]
for _ in range(m):
    a = int(input())
    memo[a] = 0

root = stairs_count(0, n, memo)
print(root)


### FIXED CODE ###

# -*- coding: utf-8 -*-
mod = 1000000007

n, m  = map(int, input().split())
dp = [0 for _ in range(n+1)]
broken = [False for _ in range(n+1)]
for _ in range(m):
    a = int(input())
    broken[a] = True

dp[0] = 1
dp[1] = 0 if broken[1] else 1
for i in range(2, n+1):
    if broken[i]:
        continue
    if not broken[i-2]:
        dp[i] += dp[i-2]
        dp[i] %= mod
    if not broken[i-1]:
        dp[i] += dp[i-1]
        dp[i] %= mod

print(dp[n])
n, m = map(int, input().split())
root = [-1] * n

def find_root(x):
    if root[x] < 0:
        return x
    else:
        root[x] == find_root(root[x])
        return root[x]

def unite(x, y):
    x = find_root(x)  
    y = find_root(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find_root(x)
    return -root[x]

for i in range(m):
    x, y = map(int,input().split())
    x -= 1
    y -= 1
    unite(x, y)

max_size = max(map(size, range(n)))

print(max_size)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

n, m = map(int, input().split())
root = [-1] * n

def find_root(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find_root(root[x])
        return root[x]

def unite(x, y):
    x = find_root(x)  
    y = find_root(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find_root(x)
    return -root[x]

for i in range(m):
    x, y = map(int,input().split())
    x -= 1
    y -= 1
    unite(x, y)

max_size = max(map(size, range(n)))

print(max_size)
_
A = list(map(int, input().split()))
A.sort()
print(A[-1]-A[0])

### FIXED CODE ###

_ = input()
A = list(map(int, input().split()))
A.sort()
print(A[-1]-A[0])