CodeEff/ECCO huggingface dataset:
# Original solution
from sys import stdin

def main():
    from collections import defaultdict
    input = stdin.readline

    n = int(eval(input()))
    a = sorted(list(map(int, input().split())))
    p = defaultdict(int)
    for x in a:
        p[x] += 1
    f = [True] * (10 ** 6 + 1)
    for k, v in list(p.items()):
        if v > 1:
            f[k] = False
        for i in range(k + k, 10 ** 6 + 1, k):
            f[i] = False
    print((sum(1 for x in a if f[x])))
main()

# Optimized solution
from sys import stdin

def main():
    from collections import defaultdict
    input = stdin.readline

    n = int(eval(input()))
    a = sorted(list(map(int, input().split())))
    p = defaultdict(int)
    for x in a:
        p[x] += 1
    q = a[-1] + 1
    f = [True] * (q)
    for k, v in list(p.items()):
        if v > 1:
            f[k] = False
        for i in range(k + k, q, k):
            f[i] = False
    print((sum(1 for x in a if f[x])))
main()
# Original solution
import collections

def main():
    N  = int(eval(input())) 
    A=list(map(int, input().split()))
    C = collections.Counter(A)
    B = list(set(A))
    B.sort()
    lenb = len(B)
    Boo = [True]*lenb
    s,_ = sieve((10**6)+5)

    if C[1]>1:
        print((0))
        return
    if C[1]==1:
        print((1))
        return

    for i in range(lenb):
        if Boo[i] and B[i]<500004:
            temp = Boo[i]*2 -1
            for j in range(i+1,lenb):
                if Boo[j] and s[B[j]-1]==False and B[j]>temp and B[j] % B[i] == 0:
                    Boo[j] = False

    cnt = 0
    for i in range(lenb):
        if Boo[i] and C[B[i]]==1:
            cnt += 1

    print(cnt)


def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return is_prime, table


if __name__ == '__main__':
    main()

# Optimized solution
import collections

def main():
    N  = int(eval(input())) 
    A=list(map(int, input().split()))
    C = collections.Counter(A)
    B = list(set(A))
    B.sort()
    lenb = len(B)
    Boo = [True]*lenb
    ZENBU = [False]*(10**6+4)

    if C[1]>1:
        print((0))
        return
    if C[1]==1:
        print((1))
        return

    for i in range(lenb):
        temp = 2
        if ZENBU[B[i]]==False:
            while B[i]*temp < 1000002:
                ZENBU[B[i]*temp] = True
                temp+=1

    cnt = 0
    for i in range(lenb):
        if ZENBU[B[i]]==False and C[B[i]]==1:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()
# Original solution
a =  int(eval(input()))
A = list(map(int, input().split()))
d_num = a

for i in range(a):
    for j in range(a):
        if(j == i): continue
        if(A[i]%A[j] == 0):
            d_num -= 1
            break
print(d_num)


# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()

ndiv_sum = 0
max_num = A[-1]
no_div = [True] * (max_num+1)
for i in range(len(A)-1):
    if no_div[A[i]]:
        for j in range(A[i], max_num+1, A[i]):
            no_div[j] = False
        if A[i]!=A[i+1]:
            ndiv_sum += 1
if no_div[A[-1]]:
    ndiv_sum += 1
print(ndiv_sum)
# Original solution
n = int(eval(input()))

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

ans = 0

for i in range(n):
	good = True
	for j in range(n):
		if j != i:
			if a[i] % a[j] == 0:
				good = False
				break
	if good:
		ans += 1

print(ans)

# Optimized solution
n = int(eval(input()))

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

mx = max(a)

mark = [0 for _ in range(mx+1)]

for i in range(n):
	for x in range(a[i], mx+1, a[i]):
		mark[x] += 1

ans = 0

for i in range(n):
	if mark[a[i]] == 1:
		ans += 1

print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
l = [0]*(max(a) + 1)
ans = 0

for i in a:
    for j in range(i, max(a) + 1, i):
        l[j] += 1

for i in a:
    if l[i] == 1:
        ans += 1

print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
ln = max(a) + 1
l = [0]*ln
ans = 0

for i in a:
    for j in range(i, ln, i):
        l[j] += 1

for i in a:
    if l[i] == 1:
        ans += 1

print(ans)
# Original solution
MAX = int(1e6)+2


n = int(eval(input()))
lis = list(map(int,input().split()))
lis2 = [0]*MAX
# lis.sort()
# m = max(lis)
ans = 0
for num in lis:
    lis2[num] += 1

for num in lis:
    for i in range(num*2, MAX, num):
        if lis2[i] > 0:
            lis2[i] += 1

print((len([i for i in lis if lis2[i] == 1])))

# Optimized solution
# MAX = int(1e6)+2


n = int(eval(input()))
lis = list(map(int,input().split()))
lis.sort()
MAX = lis[-1]
lis2 = [0]*(MAX+1)
# lis.sort()
# m = max(lis)
ans = 0

for num in lis:
    for i in range(num, MAX+1, num):
            lis2[i] += 1

for j in set(lis):
    if lis2[j] == 1:
        ans += 1
print(ans)
# Original solution
from collections import Counter
from itertools import chain


def prime_set(N):
    """
    Nまでの素数のsetを返す
    """
    if N < 4:
        return ({}, {}, {2}, {2, 3})[N]
    Nsq = int(N ** 0.5 + 0.5) + 1
    primes = {2, 3} | set(chain(list(range(5, N + 1, 6)), list(range(7, N + 1, 6))))
    for i in range(5, Nsq, 2):
        if i in primes:
            primes -= set(range(i * i, N + 1, i * 2))
    return primes


N = int(eval(input()))
A = list(map(int, input().split()))
prime = prime_set(10 ** 6 + 1)


C = Counter(A)
if C[1] == 1:
    print((1))
    exit()
if C[1] >= 2:
    print((0))
    exit()

ans = 0
for a, v in list(C.items()):
    if v >= 2:
        ans += v
        continue
    if a in prime:
        continue
    for i in range(2, int(a ** 0.5) + 1):
        if a % i == 0:
            if C[i] > 0:
                ans += 1
                break
            if C[a // i] > 0:
                ans += 1
                break

print((N-ans))

# Optimized solution
from collections import Counter
U = 10 ** 6 + 1

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

C = Counter(A)
dp = [0] * U

ans = 0
for k in sorted(C.keys()):
    if dp[k]:
        continue
    if C[k] == 1:
        ans += 1
    for i in range(k, U, k):
        dp[i] = 1

print(ans)
# Original solution
n = int(eval(input()))
arr = list(map(int, input().split()))
arr.sort()
seen = set()
maxN = 1e6
count = 0
for i in range(1, n):
    if arr[i] == arr[i-1]:
        seen.add(arr[i])
for num in arr:
    if num not in seen:
        count += 1
    curr = num
    while curr <= maxN:
        seen.add(curr)
        curr += num
print(count)


# Optimized solution
from collections import defaultdict
n = int(eval(input()))
arr = list(map(int, input().split()))
arr.sort()
count = 0
ap = defaultdict(int)
for i in range(1, n):
    if arr[i] == arr[i-1]:
        ap[arr[i]] = 1
        
for i in range(n):
    if not ap[arr[i]]:
        count += 1
    if i == 0 or arr[i] != arr[i-1]:
        for j in range(arr[i], 1000001, arr[i]):
            ap[j] = 1
print(count)
# Original solution
import bisect


def make_divisors(n):
    lower_divisors, upper_divisors = set(), set()
    tmp = 1
    while tmp * tmp <= n:
        if n % tmp == 0:
            lower_divisors.add(tmp)
            if tmp != n // tmp:
                upper_divisors.add(n // tmp)
        tmp += 1
    return lower_divisors | upper_divisors


n = int(eval(input()))
*A, = list(map(int, input().split()))
A.sort()
setA = set(A)
cnt = 0
for i, a in enumerate(A):
    if bisect.bisect_right(A, a) - bisect.bisect_left(A, a) != 1:
        cnt += 1
        continue
    X = make_divisors(a)
    for x in X:
        if x != a and x in setA:
            cnt += 1
            break
print((n - cnt))


# Optimized solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in range(1, maxA + 1)}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in range(1, maxA + 1)}
for a in A:
    if C[a] > 0:
        tmp = 2
        while a * tmp <= maxA:
            D[a * tmp] = 1
            tmp += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)
# Original solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in range(1, maxA + 1)}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in range(1, maxA + 1)}
for a in A:
    if C[a] > 0:
        tmp = 2
        while a * tmp <= maxA:
            D[a * tmp] = 1
            tmp += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)


# Optimized solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        tmp = 2
        while a * tmp <= maxA:
            D[a * tmp] = 1
            tmp += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)
# Original solution
n=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
num=[False for _ in range(max(A)+1)]
check=[False for _ in range(max(A)+1)]
for a in A:
    if num[a]:
        check[a]=True
    else:
        num[a]=True
    
for a in A:
    if a>int(max(A)**1/2):
        break
    for k in range(2,max(A)//a+1):
        num[a*k]=False

ans=0
for i in range(1,max(A)+1):
    if num[i] and not check[i]:
        ans+=1
print(ans)


# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
D=set()
S=set()
for i in range(N):
    if A[i] in S:
        D.add(A[i])
    else:
        S.add(A[i])
M=max(S)
X=[1 for i in range(M+1)]
for a in S:
    if a in D:
        X[a]=0
    for i in range(2*a,M+1,a):
        X[i]=0
ans=0
for i in range(N):
    if X[A[i]]==1:
        ans+=1
print(ans)
# Original solution
#!/usr/bin/env python

n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a)
ma = a[-1]

dup = [0 for _ in range(ma+1)]
div = [0 for _ in range(ma+1)]

for i in range(n):
    dup[a[i]] += 1
#print('dup =', dup)

for i in range(n):
    for j in range(a[i], ma+1, a[i]):
        div[j] += 1
#print('div =', div)

ans = 0 
for i in range(n):
    if div[a[i]] == 1:
        ans += 1
print(ans)


# Optimized solution
#!/usr/bin/env python

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

a = sorted(a)
ma = a[-1]
div = [0 for _ in range(ma+1)]

for i in range(n):
    for j in range(a[i], ma+1, a[i]):
        div[j] += 1

ans = 0 
for i in range(n):
    if div[a[i]] == 1:
        ans += 1
print(ans)
# Original solution
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
from math import factorial
from collections import Counter
def solve(N: int, S: str):
    counter = dict(Counter(S))
    values = list(counter.values())
    LEN = len(counter)
    answer = 0        
    for i in range(1,2**LEN):
        b = format(i,'b').zfill(LEN)
        an = 1
        for j in range(LEN):
            if b[j] == '1':
                an *= values[j]
        answer += an
        answer %= MOD

    print(answer)


    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
from collections import Counter
from itertools import product
def solve(N: int, S: str):
    counter = dict(Counter(S))
    values = list(counter.values())
    LEN = len(values)
    answer = values[0]+1
    if LEN >= 2:
        for i in range(1,LEN):
            answer *= values[i]+1
            answer%=MOD
    print((answer-1))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()
# Original solution
from collections import Counter
from itertools import product

N = int(eval(input()))
S = input().strip()
dic = Counter(S)
c = dic.most_common()
mod = 10**9 + 7

ans = 0
d = []
append = d.append
for x in c:
    if x[1] == 1:
        break
    else:
        append(x[1])
b = len(c)-len(d)

ls =list(product([0, 1], repeat=len(d)))

for x in ls:
    num = 1
    for z, y in zip(d, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans + num*(2**b))%mod
print((ans-1))

# Optimized solution
from collections import Counter
from itertools import product
 
N = int(eval(input()))
S = input().strip()
dic = Counter(S)
c = dic.most_common()
mod = 10**9 + 7
 
ans = 0
d = []
for x in c:
    if x[1] == 1:
        break
    else:
        d.append(x[1])
b = len(c)-len(d)
 
ls =list(product([0, 1], repeat=len(d)))
 
for x in ls:
    num = 1
    for z, y in zip(d, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans + num*(2**b))%mod
print((ans-1))
# Original solution
from collections import Counter
from itertools import product
 
N = int(eval(input()))
S = input().strip()
dic = Counter(S)
c = dic.most_common()
mod = 10**9 + 7
 
ans = 0
d = []
for x in c:
    if x[1] == 1:
        break
    else:
        d.append(x[1])
b = len(c)-len(d)
 
ls =list(product([0, 1], repeat=len(d)))
 
for x in ls:
    num = 1
    for z, y in zip(d, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans + num*(2**b))%mod
print((ans-1))

# Optimized solution
from collections import Counter
from itertools import product
 
N = int(eval(input()))
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print((ans-1))
# Original solution
import sys
input=sys.stdin.readline

ans = 0
# 文字列 s2 の末尾までを走査して、
# s1 にまだ表れていない文字があれば連結して、
# 連結後の s1 と、s2 から走査済みの文字を除いたものを返す
def func(s1, s2):
    global ans
    if s2 == "":
        return None
    for i,c in enumerate(s2):
        if c not in s1:
            ans += 1
            t1 = s1 + c
            t2 = s2[i+1:]
#            print(t1, t2, ans)
            func(t1, t2)

N = int(eval(input()))
S = input().strip()

func("", S)
print(ans)


# Optimized solution
import sys
input=sys.stdin.readline

N = int(eval(input()))
S = input().strip()
h = {}
for c in S:
    if c in h:
        h[c] += 1
    else:
        h[c] = 1

ans = 1
for v in list(h.values()):
    ans *= v+1
ans -= 1

print((ans%(10**9+7)))
# Original solution
# AGC031A - Colorful Subsequence
from functools import reduce


def main():
    _ = int(eval(input()))
    S = input().rstrip()
    MOD = 10 ** 9 + 7
    C = [S.count(i) + 1 for i in set(S)]
    ans = reduce(lambda x, y: (x * y) % MOD, C)
    print((ans - 1))


if __name__ == "__main__":
    main()

# Optimized solution
# AGC031A - Colorful Subsequence
def main():
    _ = int(eval(input()))
    S = input().rstrip()
    MOD = 10 ** 9 + 7
    ans = 1
    for i in set(S):
        ans *= S.count(i) + 1
    print((ans % MOD - 1))


if __name__ == "__main__":
    main()
# Original solution
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest031-A
#  TODO https://atcoder.jp/contests/agc031/tasks/agc031_a
from collections import Counter

def solveProblem(S):
	# Sはサンプル3の[abcab]を取って説明
	SSorted = sorted(S)
	# SSorted = aabbc
	stringCounterBox = Counter(SSorted)
	# [(a,2),(b,2),(c,1)]
	maxStrLength = len(stringCounterBox)
	# 文字そのものを並べる文字列長さは 1から3まで
	# print("maxStringLength:{}".format(maxStrLength))
	countList = list(stringCounterBox.values())
	# [2,2,1] と 各文字数だけ取り出した配列になった
	# print("countList:{}".format(countList))
	'''
	戦略
	1個の時→1個の配列を取り出した物を足す→2 + 2 + 1 = 5
	2個の時→取り出す文字は文字毎に数字だけパターンが替わる→ 2*2 + 2*1 + 2* 1 = 8
	3個の時 同上→ 2*2*1 = 4
	これ以上の取り出しはもう出来ない:同じ文字が出てくるため
	5 + 8 + 4 = 17 と答えと一致した
	TODO 取り出す配列番号を調べる方法が不明
	この場合なら2個の時0番目と1番目,0番目と2番目,1番目と2番目を洗い出すのはどうするのか？
	偉い人の回答待ち
	'''
	counter = 1
	for i in range(0,len(countList),+1):

		# counter = (counter * (countList[i]+1)) % (10^9+7)
		counter = (counter*(countList[i]+1)) % (pow(10,9)+7)

	answer = counter-1
	return answer


if __name__ == '__main__':
	_ = int(input().strip())
	S = str(input().strip())
	solution = solveProblem(S)
	print(("{}".format(solution)))


# Optimized solution
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest031-A
#  TODO https://atcoder.jp/contests/agc031/tasks/agc031_a
from collections import Counter

def solveProblem(S):
	# Sはサンプル3の[abcab]を取って説明
	# SSorted = sorted(S)
	# SSorted = aabbc
	# Counterクラスを使うと整列もしれくれるのでソートは不要と判断
	stringCounterBox = Counter(S)
	# [(a,2),(b,2),(c,1)]
	maxStrLength = len(stringCounterBox)
	# 文字そのものを並べる文字列長さは 1から3まで
	countList = list(stringCounterBox.values())
	# [2,2,1] と 各文字数だけ取り出した配列になった
	'''
	戦略
	リストに入った数値に1足した物を掛けて行く。最後に1を引いたのが答え。
	根拠
	このabcの時を例に出すとa,b,cの3字について
	a→0回～2回出す
	b→aと同じ
	c→0回～1回出す
	ケースの組み合わせを考えると 3 * 3 * 2 = 18通りある
	しかし 全ての文字0回という選択をすると文字列そのものが無くなってしまう。
	この場合は対象外となるので1減らす。
	'''
	counter = 1
	for i in range(0,len(countList),+1):

		# counter = (counter * (countList[i]+1)) % (10^9+7)
		counter = (counter*(countList[i]+1)) % (pow(10,9)+7)

	answer = counter-1
	return answer


if __name__ == '__main__':
	_ = int(input().strip())
	S = str(input().strip())
	solution = solveProblem(S)
	print(("{}".format(solution)))
# Original solution
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s) for s in set(S)]
cnt = 0
for i in range(len(le)):
    for s in itertools.combinations(le,i+1):
        t=1
        for tt in s:
            t*=tt
        cnt+=t
print((cnt%((10**9)+7)))

# Optimized solution
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print(((cnt-1)%((10**9)+7)))
# Original solution
import sys
from string import ascii_lowercase
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]
S = read_str()

res = 1
count = [0 for _ in range(26)]
alpha = ascii_lowercase

for i in range(N):
    if S[i] in S[:i]:
        count[alpha.find(S[i])] = S[:i].count(S[i]) + 1
        res += res // count[alpha.find(S[i])]
    else:
        res *= 2
res -= 1
big = 10**9 + 7
print((res % big))


# Optimized solution
import sys
from string import ascii_lowercase
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]
S = read_str()

res = 1
count = [0 for _ in range(26)]
alpha = ascii_lowercase

for i in range(N):
    st = alpha.find(S[i])
    count[st] += 1
    if count[st] > 1:
        res += res // count[st]
    else:
        res *= 2
res -= 1
big = 10**9 + 7
print((res % big))
# Original solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

n = ni()
s = ns()

MOD = 10**9+7

cnt = Counter(s)
ans = 1

for key, val in list(cnt.items()):
    ans *= (val+1)
    ans %= MOD
    
ans -= 1
if ans < 0:
    ans += MOD
    
print(ans)

# Optimized solution
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

n = ni()
s = ns()

cnt = Counter(s)

ans = 1
mod = 10**9+7

for k,v in list(cnt.items()):
    ans *= (v+1)
    ans %= mod
    
ans -= 1
if ans < 0:
    ans += mod
    
print(ans)
# Original solution
from itertools import combinations
p = 10**9+7
N = int(eval(input()))
S = input().strip()
C = {}
for i in range(N):
    if S[i] not in C:
        C[S[i]]=0
    C[S[i]] += 1
D = list(C.items())
n = len(D)
cnt = 0
for i in range(1,n+1):
    for x in combinations(list(range(n)),i):
        prod = 1
        for j in x:
            prod = (prod*D[j][1])%p
        cnt = (cnt+prod)%p
print(cnt)

# Optimized solution
p = 10**9+7
N = int(eval(input()))
S = input().strip()
C = {chr(i):[] for i in range(97,123)}
for i in range(N):
    C[S[i]].append(i)
cnt = 1
for j in range(97,123):
    cnt = (cnt*(1+len(C[chr(j)])))%p
print(((cnt-1)%p))
# Original solution
import itertools

from operator import mul
from functools import reduce

def comb(r,n):
  r = min(n-r,r)
  if r == 0: return 1
  over = reduce(mul, list(range(n, n - r, -1)))
  under = reduce(mul, list(range(1,r + 1)))
  return over // under

mod = 10**9 + 7

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

ans = 0

q = []

for a in "abcdefghijklmnopqrstuvwxyz":
  q.append( s.count(a) )

for a in range(1,min(26+1,n+1)):
  #print a
  for x in itertools.combinations(q,a):
    ans += reduce(mul,x)
    ans %= mod

print(ans % mod)


# Optimized solution
mod = 10**9 + 7

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

q = []

for a in "abcdefghijklmnopqrstuvwxyz":
  q.append( s.count(a) )

ans = 1

for a in q:
  ans *= (a+1)
  ans %= mod

print(ans-1)
# Original solution
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = collections.Counter(str(input().rstrip('\n')))
    t = 1
    for k, v in list(s.items()):
        t = (t * (v + 1)) % (10 ** 9 + 7)
    print((t - 1))


if __name__ == '__main__':
    slove()


# Optimized solution
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    s = collections.Counter(s)
    t = 1
    for k, v in list(s.items()):
        t *= (v + 1)
        t %= mod
    print((t - 1))


if __name__ == '__main__':
    solve()
# Original solution
import sys
from collections import Counter
from itertools import product

input = sys.stdin.readline
P = 10 ** 9 + 7


def main():
    N = int(eval(input()))
    S = input().rstrip()

    c = Counter(S)
    values = list(c.values())
    ans = -1
    for comb in product(list(range(2)), repeat=len(values)):
        res = 1
        for i, c in enumerate(comb):
            if c == 1:
                res = (res * values[i]) % P
        ans = (ans + res) % P

    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
import sys
from collections import Counter

input = sys.stdin.readline
P = 10 ** 9 + 7


def main():
    N = int(eval(input()))
    S = input().rstrip()

    c = Counter(S)
    ans = 1
    for v in list(c.values()):
        ans = (ans * (v + 1)) % P

    ans = (ans - 1) % P
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
n = int(eval(input()))
dp = [0]

for i in range(1, n+1):
    q = []
    q.append(1+dp[i-1])

    a = 1
    while True:
        a *= 6
        if a > i:
            break
        q.append(1+dp[i-a])

    b = 1
    while True:
        b *= 9
        if b > i:
            break
        q.append(1+dp[i-b])

    dp.append(min(q))

print((dp[n]))

# Optimized solution
n = int(eval(input()))
ans = pow(10, 10)

for i in range(n+1):
    cnt = 0
    j = n - i
    while i > 0:
        cnt += i % 6
        i //= 6

    while j > 0:
        cnt += j % 9
        j //= 9

    ans = min(ans, cnt)

print(ans)