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

n = int(input())
string = input()

r=g=b=0

for idx, s in enumerate(string):
    if s == 'R':
        r+=1
    elif s == 'B':
        b+=1
    elif s == 'G':
        g+=1

ans = r*g*b

for i in range(n):
    for k in range(i+1, n):
        rgb = set(['R','G','B'])
        if string[i] != string[k]:
            rgb.remove(string[i])
            rgb.remove(string[k])
            if (k+i)%2 == 0 and string[(k+i)//2] in rgb:
                ans -= 1

print(ans)

### FIXED CODE ###

n = int(input())
string = input()
r = 0
g = 0
b = 0
for c in string:
    if c == 'R':
        r += 1
    elif c == 'G':
        g += 1
    else:
        b += 1
ans = r*g*b
for i in range(n):
    for j in range(i+1, n):
        if 2*j - i >= n:
            break
        
        if string[i] != string[j] and string[i] != string[2*j-i] and string[j] != string[2*j-i]:
            ans -= 1
print(ans)
### BUGGY CODE ###

N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]-B[i],B[i]-A[i])

t=0
a=0

for i in range(N):
  if i%2==0: #高橋くんの番
    C.sort(key= lambda x: x[3],reverse=True)
    C.sort(key= lambda x: x[0],reverse=True)
    #print(i,C)
    t += C.pop(0)[0]
  if i%2==1: #青木さんの番
    C.sort(key= lambda x: x[2],reverse=True)
    C.sort(key= lambda x: x[1],reverse=True)
    #print(i,C)
    a += C.pop(0)[1]
  #print(i,C)
print(t-a)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N=int(input())
A=[0]*N
B=[0]*N
C=[0]*N

for i in range(N):
  A[i],B[i] = map(int,input().split())
  C[i]=(A[i],B[i],A[i]+B[i])

t=0
a=0

C.sort(key= lambda x: x[2],reverse=True)
#print(C)
#C.sort(key= lambda x: x[0],reverse=True)
for i in range(N):
  if i%2==0:
    t += C[i][0]
  else:
    a += C[i][1]

print(t-a)
### BUGGY CODE ###

#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    S=ST()
    
    can = set([""])
    ans = set()
    for s in S:
        for c in deepcopy(can):
            res = c+s
            if len(res) == 3:
                ans.add(res)
            elif len(res) < 3:
                can.add(res)
    print(len(ans))

if __name__ == '__main__':
    main()

### FIXED CODE ###

#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def main():
    N=int(input())
    S=input()[:-1]
    
    can = set([""]) ## 2文字以下で現在構築可能な文字列(最大10+10*10 = 1010)
    ans = set() ## 3文字で現在構築可能な文字列(最大10*10*10 = 1,000)
    for s in S: 
        for c in can.copy(): #途中でcanという集合に追加されるのでcopyする
            res = c+s #2文字以下 + 1文字 で結合する
            if len(res) == 3: #3文字なので暗証番号の候補
                ans.add(res)
            elif len(res) < 3: #2文字以下なのでcanに挿入
                can.add(res)
    print(len(ans))

    """
    copyする回数 = N * len(can) <= 10^3 * N
    for文の走査回数 = N * len(can) <= 10^3 * N
    
    全体で  2 * (10^3 * N)
    N<=3*10^4なので
    2*3* 10^3 * 10^4 = 6 * 10^7 -> 間に合わない？んですか・・・？
    """

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

# k本の花束の作り方は正直わからない
# 2**n-1通りのはなの選び方があるのは間違いない
# その中からごうけいがa,bになるものは除く
# nCa+nCb何じゃない？
# 組み合わせ数を計算するだけならめんどくさいライブラリを使わなくてもmathのfactorialで階乗を計算すれば良い
from functools import lru_cache
import math
n,a,b = map(int,input().split())


# これはfactorialの計算がやばいことになるので(10**9+7)で割りながらやっていこう
# ホントはここの10^9のループが重いみたいだなぁ
# なんか２分累乗法を使わないといけないらしい．．．実はpythonではmathのpowに標準でついています！
Big = 10**9 + 7
@lru_cache()
def cal_pow(num,w):
    if num==1:
        return w
    elif num==0:
        return 1
    else:
        half = num // 2
        rest = num % 2
        res = cal_pow(half,w) **2 * cal_pow(rest,w)
        res %= Big
        return res
all = cal_pow(n,2)-1

a_comb = 1
for i in range(a):
    # 逆元
    inv_a = cal_pow(Big-2,a-i)
    a_comb *= (n-i)*inv_a
    a_comb %= Big
b_comb = 1
for i in range(b):
    # 逆元
    inv_b = cal_pow(Big-2,b-i)
    b_comb *= (n-i)*inv_b
    b_comb %= Big
res = (all - a_comb - b_comb)
while res<0:
    res += Big
print(res)

# また出たぞ！！逆元だぁ...
# 1/x の mod p(素数) は x^(p-2)になるらしい．(フェルマーの小定理より...)
# mod(1/x) = mod(x^(p-2))






### FIXED CODE ###

# k本の花束の作り方は正直わからない
# 2**n-1通りのはなの選び方があるのは間違いない
# その中からごうけいがa,bになるものは除く
# nCa+nCb何じゃない？
# 組み合わせ数を計算するだけならめんどくさいライブラリを使わなくてもmathのfactorialで階乗を計算すれば良い
from functools import lru_cache
import math
n,a,b = map(int,input().split())


# これはfactorialの計算がやばいことになるので(10**9+7)で割りながらやっていこう
# ホントはここの10^9のループが重いみたいだなぁ
# なんか２分累乗法を使わないといけないらしい．．．実はpythonではmathのpowに標準でついています！
Big = 10**9 + 7
#@lru_cache()
def cal_pow(num,w):
    if num==1:
        return w
    elif num==0:
        return 1
    else:
        half = num // 2
        rest = num % 2
        res = cal_pow(half,w) **2 * cal_pow(rest,w)
        res %= Big
        return res
#all = cal_pow(n,2)-1
all = pow(2,n,Big)-1

a_comb = 1
for i in range(a):
    # 逆元
    # inv_a = cal_pow(Big-2,a-i)
    inv_a = pow(a-i,Big-2,Big)
    a_comb *= (n-i)*inv_a
    a_comb %= Big
b_comb = 1
for i in range(b):
    # 逆元
    #inv_b = cal_pow(Big-2,b-i)
    inv_b = pow(b-i,Big-2,Big)
    b_comb *= (n-i)*inv_b
    b_comb %= Big
res = (all - a_comb - b_comb)
while res<0:
    res += Big
print(res)

# また出たぞ！！逆元だぁ...
# 1/x の mod p(素数) は x^(p-2)になるらしい．(フェルマーの小定理より...)
# mod(1/x) = mod(x^(p-2))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
kinds=0
i=0
while i<N:
  for j in range(N):
    if A[i]<B[j]:
      for k in range(N):
        if B[j]<C[k]:
          kinds+=1
  i+=1
print(kinds)
 

### FIXED CODE ###

import bisect
point=0
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
for i in range(N):
  m=bisect.bisect_left(A,B[i])
  n=bisect.bisect_right(C,B[i])
  point+=m*(N-n)
print(point)
### BUGGY CODE ###

n = int(input())
monster = list(map(int, input().split()))
yuusha = list(map(int, input().split()))
a = sum(monster)
for i in range(n):
    while yuusha[i] != 0:
        if monster[i] > 0:
            yuusha[i] -= 1
            monster[i] -= 1
        elif monster[i + 1] > 0:
            yuusha[i] -= 1
            monster[i + 1] -= 1
        else:
            break
a -= sum(monster)
print(a)


### FIXED CODE ###

n = int(input())
monster = list(map(int, input().split()))
yuusha = list(map(int, input().split()))
a = sum(monster)
for i in range(n):
    if monster[i] < yuusha[i]:
        yuusha[i] -= monster[i]
        monster[i] = 0
        if monster[i+1] < yuusha[i]:
            yuusha[i] -= monster[i+1]
            monster[i+1] = 0
        else:
            monster[i+1] -= yuusha[i]
            yuusha[i] = 0
    else:
        monster[i] -= yuusha[i]
        yuusha[i] = 0
a -= sum(monster)
print(a)
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    b, c = map(int, input().split())
    A += [c] * b
    
A.sort(reverse=True)
print(sum(A[:N]))

### FIXED CODE ###


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

A.sort()

CB = []
for i in range(M):
    B, C = map(int, input().split())
    CB.append([C, B])
    
CB.sort(reverse=True)

idx = 0
c = 0
for i in range(N):
    if A[i] < CB[idx][0]:
        A[i] = CB[idx][0]
        c += 1
    if CB[idx][1] <= c:
        idx += 1
        c = 0
    if idx >= M:
        break
    #print(A)
        
print(sum(A))
### BUGGY CODE ###

import sys

for line in sys.stdin:
    count = 0
    n = int(line)
    
    nums = range(2, n+1)
    
    while True:
        if len(nums) == 0:
            break
        elif len(nums) == 1:
            count += 1
            break
        else:
            count += 1
            m = nums[0]
            numsCandidate = nums[1:]
            nums = [ x  for x in numsCandidate if x % m != 0 ]
    print count

### FIXED CODE ###

import math
import sys

n = 999999
nums = [1] * (n+1)
nums[:2] = [0,0]
    
cnt = 0
while cnt <= math.sqrt(n):
    flg = nums[cnt]
    if flg == 1:
        k = 2
        while k*cnt <= n:
            nums[k*cnt] = 0
            k += 1
    cnt += 1


for line in sys.stdin:
    n = int(line)
    print sum(nums[:n+1])
### BUGGY CODE ###

N,Y = map(int,input().split())
a,b,c = N+1,N+1,N+1
dama = 0
count = 0

if Y // N == 10000:
    print(N,0,0)
elif Y // N == 5000:
    print(0,N,0)
elif Y // N == 1000:
    print(0,0,N)
else:
    stop = False
    for i in range(a):
        if stop:
            break
        b -= i
        for j in range(b):
            if stop:
                break
            c -= i+j
            for k in range(c):
                if i+j+k != N:
                    pass
                else:
                    dama = 10000*i + 5000*j + 1000*k
                    if dama == Y:
                        print(i,j,k)
                        count += 1
                        stop = True
                        break
            c = N+1
        b = N+1
    if count == 0:
        print(-1,-1,-1)

### FIXED CODE ###

N,Y = map(int,input().split())
a,b,c = N+1,N+1,N+1
dama = 0
count = 0

if Y // N == 10000:
    print(N,0,0)
elif Y // N == 5000:
    print(0,N,0)
elif Y // N == 1000:
    print(0,0,N)
else:
    stop = False
    for i in range(a):
        if stop:
            break
        b -= i
        for j in range(b):
            if stop:
                break
            c -= i+j
            if i+j+c != N:
                pass
            else:
                dama = 10000*i + 5000*j + 1000*c
                if dama == Y:
                    print(i,j,c)
                    count += 1
                    stop = True
                    break
            c = N
        b = N+1
    if count == 0:
        print(-1,-1,-1)
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    G = [[] for _ in range(N)]
    G_c = [{0} for _ in range(N)]
    edges = []
    colors = {}
    for _ in range(N-1):
        a, b = (int(i) for i in input().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
        edges.append((a-1, b-1))
        colors[(a-1, b-1)] = -1
        colors[(b-1, a-1)] = -1
    seen = [False]*N
    K = 0
    used = {0}

    def dfs(v):
        todo = []
        seen[v] = True
        todo.append(v)
        while todo:
            u = todo[-1]
            for next_v in G[u]:
                if seen[next_v]:
                    continue
                can = (G_c[u] | G_c[next_v])
                if can ^ used:
                    c = max(can ^ used)
                else:
                    c = max(can) + 1
                    used.add(c)
                # print(u, next_v, G_c[u] | G_c[next_v], c)
                seen[next_v] = True
                colors[u, next_v] = c
                colors[next_v, u] = c
                G_c[u].add(c)
                G_c[next_v].add(c)
                todo.append(next_v)
                break
            else:
                todo.pop()
    dfs(0)
    # print(G_c)
    print(max(len(c) - 1 for c in G_c))
    for e in edges:
        print(colors[e])


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    G = [[]*N for _ in range(N)]
    edge_color = {}
    key_ = []
    for _ in range(N-1):
        a, b = (int(i) for i in input().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
        edge_color[(a-1, b-1)] = -1
        key_.append((a-1, b-1))
    from collections import deque
    deg_max = 0
    for g in G:
        deg_max = max(deg_max, len(g))

    G_color = ['WHITE' for _ in range(N)]
    G_distance = [float('inf') for _ in range(N)]
    G_parent = ['NIL' for _ in range(N)]

    def bfs(s):
        G_color[s] = 'GRAY'
        G_distance[s] = 0
        Q = deque()
        Q.append(s)
        while Q:
            u = Q.popleft()
            if G_parent[u] == 'NIL':
                now_color = 1
            else:
                now_color = (edge_color[(G_parent[u], u)] + 1) % deg_max
            for v in G[u]:
                if G_color[v] == 'WHITE':
                    G_color[v] = 'GRAY'
                    G_distance[v] = G_distance[u] + 1
                    G_parent[v] = u
                    Q.append(v)
                    edge_color[(u, v)] = now_color % deg_max
                    now_color += 1
            G_color[u] = 'BLACK'
    bfs(0)
    print(deg_max)
    for k in key_:
        print(edge_color[k]+1)


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

from collections import defaultdict, deque, Counter
import sys
input = sys.stdin.readline
MOD = 10 ** 9 + 7


# 素因数分解
def prime_factorize(n):
    a = defaultdict(int)
    while n % 2 == 0:
        a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        a[n] += 1
    return a


def main():
    n = int(input())
    A = list(map(int, input().split()))
    l = defaultdict(int)
    for a in A:
        c = prime_factorize(a)
        for k, v in c.items():
            l[k] = max(l[k], v)
    ans = 0
    lcm = 1
    for k, v, in l.items():
        lcm *= k ** v
    for a in A:
        ans += lcm // a
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
# INF = float("inf")


# 最大公約数
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    l = 1
    for a in A:
        l = lcm(l, a)
    c = 0
    for a in A:
        c += pow(a, MOD - 2, MOD)
    ans = l * c % MOD
    print(ans)


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

def check(i):
    num=int(i**0.5)
    if i==1:return 0
    if i==2:return 1
    for j in range(2,num+1):
        if i%j==0:break

    else:return 1
    return 0
q=int(input())
lr=[list(map(int,input().split())) for i in range(q)]

for l,r in lr:
    cnt=0
    for i in range(l,r+1,2):
        if check(i):
            next_num=int((i+1)//2)
            cnt+=check(next_num)
    print(cnt)

### FIXED CODE ###

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

def jud(i):
    #iの素数判定
    num=int(i**0.5)+1
    for k in range(2,num):
        if i%k==0:
            return 0
    return 1

s=[0]*(10**5+1)
for i in range(2,10**5+1):
    if i%2==0:
        s[i]=s[i-1]
    else:
        if jud(i)*jud((i+1)//2)==1:
            s[i]=s[i-1]+1
        else:
            s[i]=s[i-1]

for k,v in l:
    ans=s[v]-s[k-1]
    print(ans)
### BUGGY CODE ###

S = input()
Q = int(input())

for i in range(Q):
    T = input().split()
    if len(T) == 1:
        S = "".join(list(reversed(S)))
    else:
        if T[1] == "1":
            S = T[2] + S
        else:
            S = S + T[2]
print(S)

### FIXED CODE ###

S = input()
Q = int(input())

c = 0
R = ""
L = ""
for _ in range(Q):
    T = input().split()
    if len(T) == 1:
        c +=1
    else:
        if T[1] == "1":
            if c % 2 == 0:
                L = T[2] + L
            else:
                R = R + T[2]
        else:
            if c % 2 == 0:
                R = R + T[2]
            else:
                L = T[2] + L
if c % 2 == 0:
    print(L + S + R)
else:
    print("".join(list(reversed(L+S+R))))
### BUGGY CODE ###

import collections
n=int(input())
a=list(input().split())
c=collections.Counter(a)
for i in range(n):
  ans=0
  for k,v in c.items():
    if a[i]==k:
      ans+=(v-1)*(v-2)//2
    else:
      ans+=v*(v-1)//2
  print(ans)



### FIXED CODE ###

import collections
n=int(input())
a=list(input().split())
c=collections.Counter(a)
ans=0
for v in c.values():
  ans+=v*(v-1)//2
for i in range(n):
  v=c[a[i]]
  print(ans+((v-1)*(v-2)//2)-(v*(v-1)//2))
### BUGGY CODE ###

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

L.sort()
ans = 0
mem_k = 2
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(mem_k, N):
            if L[k] >= L[i] + L[j]:
                ans -= 1
                break
        ans += k - j
        mem_k = max(k, j+1)
    mem_k = i + 2

print(ans)



### FIXED CODE ###

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

L.sort()
ans = 0
mem_k = 2
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(mem_k, N):
            if L[k] >= L[i] + L[j]:
                ans -= 1
                break
        ans += k - j
        mem_k = max(k, j+1)
    mem_k = i + 2

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

a = input()
s=0
s = int(a)
for i in range(len(a)):
    s=s+int(a[i])


if int(a)%9==0:
    print('Yes')
elif s%9==0:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

a = input()
s = int(a)
s = list(map(int, a))
b=int(a)


if b%9==0 or sum(s)%9==0:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

N, M = map(int, input().split())
LR = []

for i in range(M):
    l, r = map(int, input().split())
    LR.append(set(range(l, r+1)))

ans = LR[0]

for i in range(1, M):
    ans = ans & LR[i]

print(min(len(ans), N))

### FIXED CODE ###

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

for i in range(M):
    l, r = map(int, input().split())
    
    if i==0:
        left = l
        right = r

    else:
        if l>left:
            left = l
        if r<right:
            right = r

print(0) if left>right else print(right-left+1)
### BUGGY CODE ###

# key not available ""
import math
n, k = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
dp = [0]*n
dp[0] = 0
for i in range(1, n):
    for j in range(i-1, max(-1, i-k-1), -1):
        if j == i-1:
            dp[i] = dp[j]+abs(arr[i]-arr[j])
        else:
            dp[i] = min(dp[i], dp[j]+abs(arr[i]-arr[j]))

print(dp[-1])


### FIXED CODE ###

# key not available ""
import sys
n, k = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
dp = [sys.maxsize]*n
dp[0] = 0
for i in range(n):
    for j in range(i+1, i+k+1):
        if j < n:
            dp[j] = min(dp[j], dp[i]+abs(arr[i]-arr[j]))
print(dp[-1])
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        ans += (A[i] * A[j])

print(ans % mod)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7

ans = 0
total = sum(A)
for i in range(N - 1):
    total -= A[i]
    ans += (A[i] * total) 

print(ans % mod)
### BUGGY CODE ###

from math import sqrt
from collections import Counter

def primes(N):
    is_prime = [True]*(N+1)
    is_prime[0] = False
    is_prime[1] = False
    D = [0]*(N+1)
    for n in range(2, int(sqrt(N)+1)):
        if is_prime[n]:
            D[n] = n
            j = n+n
            while j <= N:
                is_prime[j] = False
                D[j] = n
                j+=n
    for n in range(int(sqrt(N)), N+1):
        if is_prime[n]:
            D[n] = n
                
    return is_prime, D

def solve(N):
    is_prime, D = primes(N)
    total = 0
    for c in range(1, N-1):
        if is_prime[N-c] and False:
            total += 2
            continue

        C = Counter()
        x = N-c
        while x >= 2:
            d = D[x]
            C[d] += 1
            x //= d
        a = 1
        for k, v in C.items():
            a *= (v+1)
        #print(f"{N=} {c=}, {a=}, {C=}")
        total += a
    # c = N-1
    total += 1
    return total

N = int(input())
print(solve(N))

### FIXED CODE ###

from math import sqrt
from collections import Counter

def primes(N):
    is_prime = [True]*(N+1)
    is_prime[0] = False
    is_prime[1] = False
    D = [0]*(N+1)
    for n in range(2, int(sqrt(N)+1)):
        if is_prime[n]:
            D[n] = n
            j = n+n
            while j <= N:
                is_prime[j] = False
                D[j] = n
                j+=n
    for n in range(int(sqrt(N)), N+1):
        if is_prime[n]:
            D[n] = n
                
    return is_prime, D

def solve(N):
    is_prime, D = primes(N)
    total = 0
    for c in range(1, N-1):
        if is_prime[N-c] and False:
            total += 2
            continue

        C = Counter()
        x = N-c
        while x >= 2:
            d = D[x]
            C[d] += 1
            x //= d
        a = 1
        for k, v in C.items():
            a *= (v+1)
        #print(f"{N=} {c=}, {a=}, {C=}")
        total += a
    # c = N-1
    total += 1
    return total

N = int(input())
print(solve(N))
### BUGGY CODE ###

from collections import Counter
s = input()
n = len(s)

dp = [0] * (n+1)

for i in range(n):
    t = int(s[i:])%2019
    dp[i] = t
c = Counter(dp)
ans = 0
for k, v in c.items():
    ans+=v*(v-1)//2
print(ans)

### FIXED CODE ###

s = input()

n = len(s)
c = [0]*2019
c[0]+=1
t = 0
digit = 1
for ss in s[::-1]:
    t = (t+int(ss)*digit) % 2019
    digit = (digit * 10) % 2019
    c[t]+=1
ans = 0
ans = sum(cc*(cc-1)//2 for cc in c)
print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
s = input()
ss = []

cnt = 0

if s[0] == '0': ss.append(0)
i = 0
while i < n:
    j = i
    while j < n and s[i] == s[j]: j += 1
    ss.append(j-i)
    i = j
if s[-1] == '0': ss.append(0)

#print(ss)
ans = []
i = 0
while i < n:
    #print(ans, i, sum(ss[i:i+2*k+1]))
    #if i+2*k+1 > n:
    #    break
    ans.append(sum(ss[i:i+2*k+1]))
    i += 2

print(max(ans))


### FIXED CODE ###

n, k = map(int, input().split())
s = input()
ss = []

cnt = 0

if s[0] == '0': ss.append(0)
i = 0
while i < n:
    j = i
    while j < n and s[i] == s[j]: j += 1
    ss.append(j-i)
    i = j
if s[-1] == '0': ss.append(0)

right = 2*k+1
left = 0
val = sum(ss[:right])
ans = val

#print(ss)
while right < len(ss):
    for i in [1, 2]:
        #print('for', ss[left], ss[right])
        val += ss[right]
        val -= ss[left]
        left += 1
        right += 1
    #print(left, right, val)
    ans = max(ans, val)
    
print(ans)