peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
X = int(input())

def isSosu(x):
    if x == 2:
        return True
    if x % 2 == 0:
        return False
    for i in range(3, x - 1, 2):
        if x % i == 0:
            return False
    return True

while True:
    if isSosu(X):
        print(X)
        break
    X += 1
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
A = abs(x-a)
B = abs(x-b)
if A>B:
  print("A")
else:
  print("B")
# Judge status: Accepted
n,k = map(int, input().split())
x = list(map(int, input().split()))
ans = 10 ** 9
for i in range(n-k+1):
  a = abs(x[i+k-1] - x[i])
  ans = min(ans,min(abs(x[i+k-1])+a,abs(x[i])+a))
print(ans)
# Judge status: Wrong Answer
from itertools import accumulate
mod= 1e9+7 
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans =0
    ac = list(accumulate(a))
 
    for i in range(n):
        ans += a[i]* (ac[-1]-ac[i])
        ans %=mod
    print(int(ans))
# Judge status: Accepted
import sys

n, a, b, c, d = map(int, input().split())
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = input()

for i in range(a + 1, max(c, d) - 1):
    if s[i: i + 2] == '##':
        print('No')
        sys.exit()

if c < d:
    print('Yes')
    sys.exit()

for i in range(b, d + 1):
        if s[i - 1: i + 2] == '...':
            print('Yes')
            sys.exit()

print('No')
# Judge status: Accepted
s=int(input())
a=[s]
b=0
f=False
for i in range(10**6):
	if a[i]%2 == 0:
		a.append(a[i]//2)
	else:
		a.append(a[i]*3+1)
	for j in range(i):
		if a[i]==a[j]:
			b=i+1
			f=True
			break
	if f:
		break
print(b)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n = ini()
    a = inl()
    cur = 1
    for x in a:
        if x == cur:
            cur += 1
    if cur == 1:
        return -1
    return n + 1 - cur


print(solve())
# Judge status: Accepted
n = int(input())
max_cnt = 0
res = 1
for i in range(n,0,-1):
    cnt = 0
    nn = i
    while nn % 2 == 0:
        nn = nn / 2
        cnt += 1
    if cnt > max_cnt:
        max_cnt = cnt
        res = i
print(res)
# Judge status: Accepted
h,m,hh,mm,k = map(int,input().split())

wakeup = (hh-h)*60 + mm - m

print(wakeup-k)
# Judge status: Wrong Answer
import math
N, D = map(int, input().split())
print(math.ceil((N - 1) / (2 * D + 1)))
# Judge status: Wrong Answer
n=int(input())
a=[[0]*9 for i in range(9)]
for i in range(n):
    x,y =int(str(i)[0]), int(str(i)[-1])
    if y>0:
        a[x-1][y-1]+=1
count=0
for i in range(9):
    for j in range(9):
        if i>j:
            continue
        if i==j:
            count+=a[i][j]**2
        else:
            count+=a[i][j]*a[j][i]*2
print(count)
# Judge status: Wrong Answer
s=list(input())
for i in range(len(s)//2):
    s.pop()
    if s[:len(s)//2]==s[len(s)//2:]:
        break
print(len(s))
# Judge status: Accepted
n, x, y = map(int, input().split())
ans = [0] * (n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        # iとjを固定、rangeでi<jを表現
        d = min(j-i, abs(x-i)+abs(j-y)+1, abs(y-i)+abs(x-j)+1)
        # 長さを示すところに+１
        ans[d-1] += 1
print(*ans, sep="\n")
# Judge status: Accepted
def f(x, A, B):
    return int(A*x / B) - A * int(x / B)
A, B, N = map(int, input().split())

print(f(min(B-1, N), A, B))
# Judge status: Accepted
A,B,C,X,Y = map(int,input().split())

AB_set = C * 2

ans = min(A*X + B*Y, AB_set*max(X,Y), AB_set*min(X,Y) + A*abs(X-min(X,Y)) + B*abs(Y-min(X,Y)))

print(ans)
# Judge status: Wrong Answer
n = int(input())

l = len(str(n))
ans = 9 * (l-1) + int(str(n)[0]) - 1
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if (a*b)%2==0:
    print("Even")
else:
    print("0dd")
# Judge status: Wrong Answer
s = input()

s = s.replace("dreamer", "")
s = s.replace("dream", "")
s = s.replace("eraser", "")
s = s.replace("erase", "")

if len(s) > 0:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
X,Y= map(int,input().split())
a = Y/2-X 
b = X*2-Y/2

if Y%2 ==0:
    if a >= 0 and b >= 0:
        print('Yes')
    else:
        print('No')
else:
    print('No')
# Judge status: Accepted
S="".join(sorted(set(input())))
print("Yes" if S=="ENSW" or S=="NS" or S=="EW" else "No")
# Judge status: Accepted
n=int(input())
c,s,f=[0]*(n-1),[0]*(n-1),[0]*(n-1)
for i in range(n-1):
    c[i],s[i],f[i]=map(int,input().split())
for j in range(n-1):
    t=s[j]+c[j]
    now=j+1
    while now<n-1:
        if s[now]<t:
            t=((-t)//f[now])*(-f[now])
        else:
            t=s[now]
        t+=c[now]
        now+=1
    print(t)
print(0)
# Judge status: Wrong Answer
# coding: utf-8

N = int(input())
S = input()

# ruisekiwa ba-jon

ruiseki_w = [0] * (N + 1)
ruiseki_e = [0] * (N + 1)

for i in range(0, len(S)):
    ruiseki_w[i+1] = ruiseki_w[i] + S[i].count("W")
    ruiseki_e[i+1] = ruiseki_e[i] + S[i].count("E")

res = 10**10
for i in range(0, len(S)):
    res = min(ruiseki_w[i-1] - ruiseki_w[0] + ruiseki_e[-1] - ruiseki_e[i+1], res)
print(res)
# Judge status: Wrong Answer
A, B, C = map(int,input().split())

if (A * C) <= B:
    answer = C
else:
    answer = B % A
print(answer)
# Judge status: Accepted
x = list(map(int, input().split()))
x = set(x)
if len(x) == 2:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
ans = []
cnt = 0
for i in range(1, n + 2):
    cnt += i
    ans.append(i)
    if cnt > n:
        ans.remove(cnt - n)
        break
print('\n'.join(map(str, ans)))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
 
cnt = 0
idx = 0
while 1:
  if (cnt+1) in A[idx:]:
    cnt += 1
    idx = A.index(cnt)
  else:
    break

if cnt == 0:
  print(-1)
else:
  print(len(A)-cnt)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

tmp = sum(b) - sum(a)
numa, numb = 0, 0
for i in range(N):
    if a[i] > b[i]:
        numb += a[i] - b[i]
    elif a[i] < b[i]:
        numa += (b[i] - a[i] + 1) // 2

if numa <= tmp and numb <= tmp:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
data = list(map(int, input().split()))
mx = max(data)
marked = [0]*(mx + 1)
for a in data:
    for x in range(a, mx+1, a):
        marked[x] += 1
ans = 0
for a in data:
    if marked[a] == 1:
        ans += 1
print(ans)
# Judge status: Wrong Answer
N,T = map(int,input().split())
m = 1001
for i in range(N):
  c,t = map(int,input().split())
  if t <=T:m=min(c,t)
print("TLE" if m==1001 else m)
# Judge status: Accepted
n, m = map(int, input().split())
ACc = [0 for i in range(n)]
WAc = [0 for i in range(n)]

for i in range(m):
    p, s = input().split()
    p = int(p)
    if s == "AC":
        if ACc[p - 1] == 0:
            ACc[p - 1] += 1
    else:
        if ACc[p - 1] != 1:
            WAc[p - 1] += 1
for j in range(n):
    if ACc[j] == 0:
        WAc[j] = 0

print(sum(ACc), sum(WAc))
# Judge status: Accepted
a = list(input())
b = set(a)
cnt = 0
for i in b:
    if a.count(i) % 2 != 0:
        cnt += 1
if cnt == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n,0,-1):
    s=0
    for j in range(1,n+1):
        if j*i<=n:
            s+=b[i*j-1]
        else:
            break
    if s%2!=a[i-1]:
        b[i-1]+=1
c=[]
for i in range(n):
    if b[i]==1:
        c.append(i+1)
m=sum(b)
print(m)
print(*c)
# Judge status: Wrong Answer
n,m=map(int,input().split())
d=[0]*(n+1)
for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0:
        if n==1:
            pass
        else:
            print(-1)
            exit()
            
    if d[s]==c:
        continue
    elif d[s]!=c and d[s]==0:
        d[s]=c
    else:
        print(-1)
        exit()
print("".join(list(map(str,d[1:]))))
# Judge status: Accepted
N = int(input())
xl = [0] * N
for i in range(N):
  x, l = map(int ,input().split())
  a = x - l
  b = x + l
  xl[i] = [a, b]
  
xl = sorted(xl, key = lambda x:x[1])

ans = 0
now = 0
for i in range(N):
  if i == 0:
    ans += 1
    now = xl[0][1]
  else:
    if xl[i][0] >= now:
      ans += 1
      now = xl[i][1]
      
print(ans)
# Judge status: Accepted
import collections
w = input()
w = sorted(w)

if len(w) % 2 != 0:
    print('No')
    exit()
C = collections.Counter(w)

C = list(C.values())


for i in range(len(C)):
    if C[i] % 2 != 0:
        print('No')
        exit()

print('Yes')
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]
a_sort = sorted(a)
m1 = a[0]
m2 = a[1]
for i in range(n):
  if a[i] == m1:
    print(m2)
  else:
    print(m1)
# Judge status: Accepted
N, M = map(int, input().split())
ans1 = 0
ans2 = 0
Q = [0] * N
wrong = [0] * N
for i in range(M):
  p, S = map(str, input().split())
  p = int(p) - 1
  if Q[p] == 0 and S == "AC":
    ans1 += 1
    ans2 += wrong[p]
    Q[p] = 1
  elif S == "WA":
    wrong[p] += 1
print(ans1,ans2)
# Judge status: Accepted
import math
n,m = map(int,input().split())
if abs(n-m)>1:
    print(0)
elif abs(n-m)==1:
    print((math.factorial(n) * math.factorial(m))%(10**9+7))
else:
    print((2 * math.factorial(n) * math.factorial(m))%(10**9+7))
# Judge status: Wrong Answer
N=int(input())
S=input()
ans=0
for i in range(N-1):
  A=len(set(S[:i+1])&set(S[i:]))
  ans=max(A,ans)
print(ans)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
X = list(map(int, input().split()))
c = Counter(X)
Xsort = sorted(X)
for i in range(n):
    if X[i]<Xsort[n//2-1]:
        if X[i] == Xsort[n//2] and c[X[i]] == 1:
            print(Xsort[n//2-1])
        else:
            print(Xsort[n//2])
    else:
        if X[i] == Xsort[n//2-1] and c[X[i]] == 1:
            print(Xsort[n//2])
        else:
            print(Xsort[n//2-1])
# Judge status: Accepted
from itertools import product
A, B = list(map(int, input().split()))
print(max(a+b for a, b in product([A, B-1], [B, A-1])))
# Judge status: Accepted
# 再帰的なDFS
def rec(d, val, nums):
    nums.append(val)
    if d == 10:
        return
    
    for delta in (-1, 0, 1):
        add = val % 10 + delta
        if add >= 0 and add <= 9:
            rec(d+1, val * 10 + add, nums)

def main():
    K = int(input())
    nums = []
    for val in range(1, 10):
        rec(1, val, nums)
    nums.sort()
    print(nums[K-1])

main()
# Judge status: Wrong Answer
_ = input()
a = [int(x) for x in input().split()]

a = sorted(set(a))
a.reverse()
ans = 1
cnt = 0
for i in a:
    c = a.count(i)
    if 4 <= c:
        print(i ** 2)
        break
    elif 2 <= c:
        if cnt == 0:
            ans *= i
            cnt += 1
        else:
            print(ans * i)
            break
else:
    print(0)
# Judge status: Accepted
n = int(input())
m = 0
a = n // 3
b = n // 5
c = n // 15
for i in range(1,n+1):
    m = m+i
for j in range(1,a+1):
    m = m-(3*j)
for k in range(1,b+1):
    m = m-(5*k)
for l in range(1,c+1):
    m = m+(15*l)
print(m)
# Judge status: Accepted

#!/usr/bin/env python3
a = int(input())
print(a + a**2 + a**3)
# Judge status: Accepted
def comb(n, k):
    ret = 1
    for i in range(1, k + 1):
        ret = ret * (n - i + 1) % MOD        
        ret = ret * pow(i, MOD - 2, MOD) % MOD

    return ret


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

MOD = 10 ** 9 + 7

if (2 * Y - X < 0 or 2 * X - Y < 0
        or (2 * Y - X) % 3 != 0
        or (2 * X - Y) % 3 != 0):
    print(0)
    exit()

a = (2 * Y - X) // 3
b = (2 * X - Y) // 3

print(comb(a + b, a))
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
s = set()
for i in range(1, 10):
    for j in range(1, 10):
        s.add(i*j)
if N in s:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
l=list(map(int,input().split()))
l.sort(reverse=True)
ans=l[0]*9+sum(l)
# Judge status: Accepted
s = input()
t = s[::-1]
count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count += 1
print(int(count/2))
# Judge status: Wrong Answer
x = int(input())
if x<100 or (x%100)%5+1>x//100:
  print(0)
else:
  print(1)
# Judge status: Accepted
N=int(input())
ans=0
for n in range(1,N+1,2):
    a=0
    for w in range(1,n+1,2):
        if n%w==0:
            a+=1
    if a==8:
        ans+=1
print(ans)
# Judge status: Wrong Answer
S = list(input())
for i in range(1, len(S)):
    del S[-1]
    if len(S)%2==0 and S[0:len(S)//2] == S[len(S)//2:]:
        print(len(S))
# Judge status: Accepted
import bisect
n,h = map(int,input().split())
a = []
b = []
for i in range(n):
    x,y = map(int,input().split())
    a.append(x)
    b.append(y)
a.sort()
b.sort()
index = bisect.bisect_left(b,a[-1])
ans = 0
count = 0
for i in range(n-1,index-1,-1):
    count += 1
    ans += b[i]
    if ans >= h:
        print(count)
        exit()
print(count + (h-ans+a[-1]-1)//a[-1])
# Judge status: Wrong Answer
aas = [int(input()) for _ in range(5)]
k = int(input())
for i in range(1,5):
  if aas[i]-aas[i-1]>k:
    print(':(')
    exit()
print('Yay!')
# Judge status: Accepted
n=int(input())
n=str(n)
if n[-1]=='2' or n[-1]=='4' or n[-1]=='5' or n[-1]=='7' or n[-1]=='9':
  print('hon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
  print('pon')
else:
  print('bon')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dif = sum(b) - sum(a)

numa, numb = 0, 0
for i in range(n):
    if a[i] > b[i]:
        numb += a[i] - b[i]
    elif a[i] < b[i]:
        numa += (b[i] - a[i] + 1) // 2

# if numa <= dif and numb <= dif:
if numa <= dif:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b,c,d=map(int, input().split())
    x=abs(a-b)
    y=abs(c-b)
    z=abs(c-a)
    if z<=d or (x<=d and y<=d):
        print('Yes')
    else:
        print('No')
resolve()
# Judge status: Wrong Answer
a,b = map(int, input().split())
print("{}".format((a+b)//2))
# Judge status: Accepted
A=int(input())
import collections
B=list(map(int,input().split()))
B=collections.Counter(B)
C=list(B.keys())
D=list(B.values())
ans = 0
for i,j in zip(C,D):
    if i > j:
        ans+=j
    elif i < j:
        ans+=j-i
print(ans)
# Judge status: Accepted
n, p = map(int, input().split())
a = list(map(int, input().split()))

dp = [[0] * 2 for _ in range(n + 1)]
dp[0][0] = 1

for i, e in enumerate(a, 1):
    if e % 2:
        dp[i][0] = dp[i-1][0] + dp[i-1][1]
        dp[i][1] = dp[i-1][1] + dp[i-1][0]
    else:
        dp[i][0] = dp[i-1][0] * 2
        dp[i][1] = dp[i-1][1] * 2

print(dp[n][p])
# Judge status: Wrong Answer
N, T = map(int, input().split())
lists = [list(map(int, input().split())) for i in range(N)]

cost = 0
count = 0
for i in range(N):
    if lists[i][1] <= T:
        count += 1
        if i == 0:
            cost = lists[i][0]
        elif cost >= lists[i][0]:
            cost = lists[i][0]
        else:
            continue
    else:
        continue
if count == 0:
    print("TLE")
else:
    print(cost)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
cnt=[0]*60
for elem in a:
    for i in range(60):
        cnt[i]+=(elem>>i)%2
ans=0
for i in range(60):
    ans+=((cnt[i]*(n-cnt[i]))<<i)%mod
print(ans%mod)
# Judge status: Accepted
hotel=int(input())
hotel2=int(input())
hotel3=int(input())
hotel4=int(input())

if hotel > hotel2:
	sum1=int(hotel2)*int(hotel3)
	hotel5=int(hotel)-int(hotel2)
	sum2=int(hotel5)*int(hotel4)
	fee=int(sum1)+int(sum2)
else:
  fee=int(hotel)*int(hotel3)
 
print(str(fee))
# Judge status: Accepted
a, b, c = map(int, input().split())
iroha = [a, b, c]
if iroha.count(5) == 2 and iroha.count(7) == 1:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n = int(input())

a = []
while n != 0:
    if n%2 == 0:
        a.append(0)
    else:
        a.append(1)
        n -= 1
    n//=(-2)
    
if n == 0:
    print(0)
else:
    print(''.join(map(str, a[::-1])))
# Judge status: Accepted


N = int(input())
S = 0
for i in range(1, N+1):
    if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
        continue
    S+=i
print(S)
# Judge status: Wrong Answer
from fractions import gcd
# 最小公倍数
def lcm(x, y):
    return x / gcd(x, y) * y

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

x = A[0]
for i in range(N):
    x = gcd(x, A[i]) 


sums = 0
mod = 10 ** 9 + 7
for i in range(N):
    sums += x // A[i]
    sums %= mod

print(sums)
# Judge status: Accepted
import sys
import itertools
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
N,K=nm()

mod=10**9+7
ans=0

for i in range(K,N+2):
    ans+=(N+(N-i+1))*i/2-(0+(i-1))*i/2+1

print(int(ans%mod))
# Judge status: Accepted
S = input()

ans = 999
for i in range(len(S)-2):
  ans = min(ans,abs(int(S[i:i+3]) - 753))

print(ans)
# Judge status: Wrong Answer
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
else:
  if (K-(A-1))%2==0:
    bis=int(A+(B-A)*(K-(A-1))/2)
  else:
    bis=int(A+(B-A)*((K-(A-1))//2)+1)
print(int(bis))
# Judge status: Wrong Answer
import collections

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

q = collections.deque()
q.append(1)

for i in range(2):
    for j in range(len(q)):
        tmp = q.pop()
        for i in s:
            if tmp in i:
                if tmp > i[0]:
                    q.append(i[0])
                else:
                    q.append(i[1])

if n in q:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Judge status: Wrong Answer
n=int(input())
t=n+n^2+1
print(t*n)
# Judge status: Accepted
def main():
  N = int(input())
  A = list(map(int, input().split()))

  ans = 1
  x=y=0
  for i in range(1, N):

    if A[i - 1] < A[i]:
      x = 1

    if A[i - 1] > A[i]:
      y = 1

    if x and y:
      ans += 1
      x = y = 0

  print(ans)

main()
# Judge status: Accepted
a = list(map(int, input().split()))
a_set = len(set(a))

if a_set == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
c=input()
a=ord(c)+1
print(str.lower(chr(a)))
# Judge status: Wrong Answer
A,B=input().split()
import math
math.ceil((int(B)-1)/(int(A)-1))
# Judge status: Wrong Answer
import bisect
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
#print(a,b,c)
cnt = 0
for i in range(n):
    d = bisect.bisect_left(a,b[i])
    e = bisect.bisect_left(c,b[i])
    cnt += d*(n-e)
print(cnt)
# Judge status: Accepted
X = (int(input()) - 400) // 200
print(8-X)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if b-a == c-a:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
list_b = list(map(int,input().split()))
b_len = len(list_b)
ans_list = [0]*n
ans_list[0] = list_b[0]
dum = 0
for i in range(1,b_len):
    dum = min(list_b[i-1],list_b[i])
    ans_list[i] = dum
ans_list[n-1] = list_b[b_len-1]
#print(ans_list)
print(sum(ans_list))
# Judge status: Wrong Answer
c = input()
if c in "a" or "e" or "i" or "o" or "u":
  print("vowel")
else:
  print("consonant")
# Judge status: Accepted
def no():
    print("No")
    exit()

n, a, b, c, d = map(int, input().split())
s = list(input())
for i in range(a - 1, c - 1):
    if s[i] == s[i + 1] == "#":
        no()
for i in range(b - 1, d - 1):
    if s[i] == s[i + 1] == "#":
        no()
if c > d:
    t = 0
    for i in range(b - 2, d - 1):
        if s[i] == s[i + 1] == s[i + 2] == ".":
            t = 1
    if t == 0:
        no()
print("Yes")
# Judge status: Wrong Answer
A, B, X = map(int, input().split())
if A+B>X>A:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
# -*- coding: utf-8 -*-
# D

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
from itertools import combinations
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

n = int(input())
if n == 1:
    print('a')
    sys.exit()


def dfs(s):
    if len(s) == n:
        print(''.join([chr(s + ord('a')) for s in s]))
    else:
        for i in range(len(set(list(s))) + 1):
            dfs(s + [i])
dfs([])
# Judge status: Wrong Answer
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    s = input()

    c = collections.Counter(s)

    ans = 1
    for v in c.values():
        ans *= v + 1

    print(ans - 1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x,y,z = list(map(int,input().split()))
 
def swap(a,b):
    tmp = a
    a = b
    b = tmp
    return (a,b)
 
x,y = swap(x,y)
x, z = swap(x, z)
print(x,y,z)
# Judge status: Accepted
N,K = map(int, input().split())
 
ans = 0
 
for i in range(1, N+1):
    j = 1/N
    while i < K:
        i *= 2
        j /= 2
    ans += j
 
print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    d = (N + 10) // 11
    if 11 * d - 5 >= N:
        print(2 * d - 1)
    else:
        print(2 * d)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
a=[]
for i in range(n):
  a.append(0)
for i in range(n-1):
  a[l[i]-1]+=1
for i in range(n):
  print(a[i])
# Judge status: Accepted
n,k,s=map(int,input().split())
if s!=10**9:
  ans=[s]*n
  for i in range(k,n):
    ans[i]=s+1
else:
  ans=[s]*n
  for i in range(k,n):
    ans[i]=s-1
print(*ans)
# Judge status: Accepted
n=input()
a=n.count('1')
b=n.count('0')
if a<b:
    print(2*a)
else:
    print(2*b)
# Judge status: Wrong Answer
N,S,z=int(input()),input(),0
for i in range(N):a,b=S[:i+1],S[i:];z=max(z,len([0 for j in range(26) if chr(97+j) in a and chr(97+j) in b]))
print(z)
# Judge status: Wrong Answer
n=int(input())
B=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if min(B[:i+1])==B[i]:
    cnt+=1
print(cnt)
# Judge status: Accepted
N,M=map(int,input().split())
A=[input() for _ in range(N)]
B=[input() for _ in range(M)]
ans='No'
 
for i in range(N-M+1):
    for j in range(N-M+1):
        cnt=0
        if A[i][j:j+M] ==B[0]:
            for k in range(1,M):
                if A[i+k][j:j+M] == B[k]:
                    cnt+=1
            if cnt==M-1:
                ans='Yes'
                
print(ans)
# Judge status: Accepted
S = input()
T = input()

cnt = 0
m_cnt = 0
for i in range(len(S) - len(T) + 1):
    for j in range(len(T)):
        if S[i + j] == T[j]:
            cnt += 1

    if cnt > m_cnt:
        m_cnt = cnt
    cnt = 0

print(len(T) - m_cnt)
# Judge status: Accepted
N, M = map(int, input().split())
ac = [0] * N
wa = [0] * N

WA = 0

for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if ac[p] == 0 and s == 'AC':
        ac[p] = 1
        WA += wa[p]

    wa[p] += 1

print(sum(ac), WA)
# Judge status: Wrong Answer
s = input()
x = 0
y = 0
for i in range(len(s)):
    if s[i] == 'E':
        x +=1
    elif s[i] == 'W':
        x -=1
    elif s[i] == 'N':
        y +=1
    else:
        y -=1
    if x == 0 and y == 0:
        print('Yes')
        exit()
print('No')
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a^b:
  print('IMPOSSIBLE')
else:
  print((a+b)//2)
# Judge status: Accepted
# 数値→アルファベット
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
n=num2alpha(int(input()))
n=str(n.lower())
print(n)