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

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

c=0
for j in range(N):
    for i in range(N):
        if i<j:
            if s[i]==s[j]:
                c+=1
        else:
            break

print(c)


### FIXED CODE ###

N=int(input())
dic={}
for i in range(N):
    k="".join(sorted(list(input())))
    if k in dic:
        dic[k]+=1
    else:
        dic[k]=1
c=0
for i in dic.values():
    c += i*(i-1)

print(c//2)
### BUGGY CODE ###

while True:
    try:
        n = int(raw_input())
    except EOFError:
        break    
    
    ls = []
    for i in range(n):
        ls.append(int(raw_input()))
    
    maxvalue = -999999999999999999999999999999
    for k in range(len(ls)):
        if k == 0:
            continue
        else:
            temp = ls[k] - min(ls[:k])
        if  temp > maxvalue:
            maxvalue = temp
    print maxvalue

### FIXED CODE ###

n = int(raw_input())
R = []
R.append(int(raw_input()))
minv = R[0]
maxv = -1 * 10**9
for j in xrange(1,n):
    R.append(int(raw_input()))
    maxv = max(maxv,R[j]-minv)
    minv = min(minv,R[j])
print maxv
### BUGGY CODE ###

n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
ans=1
for i in range(p+1):
    tmp=pow(i+1,n)
    if tmp>p:
        print(ans)
        break
    if p%tmp==0:
        ans=i+1

### FIXED CODE ###

n,p=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

lst=factorization(p)
# print(lst)
ans=1
for a,b in lst:
    if b>=n:
        ans*=pow(a,b//n)
print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
mod=998244353
s=set()
for _ in range(k):
  l,r=map(int,input().split())
  s=s|set(i for i in range(l,r+1))
dp=[0]*n
dp[0]=1
for i in range(1,n):
  for j in s:
    if i-j>=0:
      dp[i]+=dp[i-j]
print(dp[n-1]%mod)


### FIXED CODE ###

n,k=map(int,input().split())
mod=998244353
l=[0]*n
r=[0]*n
for i in range(k):
  l[i],r[i]=map(int,input().split())
dp=[0]*(n+10)
dp[0]=1
sumdp=[0]*(n+10)
sumdp[1]=1
for i in range(1,n):
  for j in range(k):
    li=max(0,i-r[j])
    ri=max(0,i-l[j]+1)
    dp[i]+=sumdp[ri]-sumdp[li]
  sumdp[i+1]=(sumdp[i]+dp[i])%mod
print(dp[n-1]%mod)
### BUGGY CODE ###

import numpy as np
N, M = map(int, input().split())

key = np.zeros(N)
for i in range(0, M):
    L, R = map(int, input().split())
    key[L-1:R]+=1

print(np.sum(key==M))

### FIXED CODE ###

#!/usr/bin/env python3

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

min_, max_ = 0, 10**5
for i in range(m):
    a, b = list(map(int, input().split()))

    min_ = max(min_, a)
    max_ = min(max_, b)

print(max(max_-min_+1, 0))
### BUGGY CODE ###

import numpy as np
n,k = map(int,input().split())
p = list(map(int,input().split()))

def expect_dice(n):
    s = 0
    for i in range(1,n+1):
        s += i
    return s/n 

sum_cnt = []

for i in range(len(p)-k+1):
    out = 0
    for j in range(i,i+k):
        out += p[j]
    sum_cnt.append(out)
sum_cnt = np.array(sum_cnt)
result = 0
for k in range(k):
    result += expect_dice(p[np.argmax(sum_cnt)+k])

print(result)

### FIXED CODE ###

#累積和の利用！！！！！！！！
from itertools import accumulate
n,k = map(int,input().split())
p = list(map(int,input().split()))

m = [(e + 1) / 2 for e in p]
    
m = [0] + m
m = list(accumulate(m))

ans = []
for i in range(n-k+1):
    ans.append(m[i+k] - m[i])
    
print(max(ans))
### BUGGY CODE ###

# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(m)]
    ab_1 = [ab[i][1] for i in range(m) if ab[i][0] == 1]
    ab_m = [ab[i][0] for i in range(m) if ab[i][1] == n]

    for i in ab_1:
            for j in ab_m:
                if i == j:
                    print('POSSIBLE')
                    exit()
    else:
        print('IMPOSSIBLE')

if __name__ ==  "__main__":
    main()

### FIXED CODE ###

# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    li = [0]*200001

    for _ in range(m):
        a, b = map(int, input().split())
        if a == 1:
            if li[b] == 0:
                li[b] = 1
            else:
                print('POSSIBLE')
                exit()
        if b == n:
            if li[a] == 0:
                li[a] = 1
            else:
                print('POSSIBLE')
                exit()
    else:
        print('IMPOSSIBLE')

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

import itertools

n = int(input())
a = list(map(int, input().split()))
d = {}
for i in a:
    d[i] = d.get(i, 0)+1

for i in a:
    d[i] -= 1
    temp = 0
    for j in d.values():
        temp += len(list(itertools.combinations(range(j),2)))
    print(temp)
    d[i] += 1

### FIXED CODE ###

import itertools
import math 
def C(n,r):
    if n-r < 0:
        return 0 
    return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

n = int(input())
a = list(map(int, input().split()))
d = {}
for i in a:
    d[i] = d.get(i, 0)+1

c = 0
cc = {}
for key, val in d.items():
    temp = C(val,2)
    c += temp
    if cc.get(key) is None:
        cc[key] = temp - C(val-1,2)
for i in a:
    print(c - cc[i])
### BUGGY CODE ###

F = {}

def fib(n):
  global F
  if n < 0:
    print("error")
    exit()
  if n < 2:
    F[n] = 1
    return F[n]
  F[n] = fib(n-1) + fib(n-2)
#  F[n] = F[n-1] + F[n-2]
  return F[n]

n = int(input())
print(fib(n))
#n = int(input())
#print(fib(n))
#fib(44)
#for i in range(44+1):
#  print(fib(i))
#  print(F[i])

### FIXED CODE ###

def fibr(n):
    if arr[n] != 0:
        return arr[n]
    if n < 2:
        arr[n] = 1
    else:
        arr[n] = fibr(n-1) + fibr(n-2)
    return arr[n]

n = int(input())
arr = [0 for i in range(n+1)]
print(fibr(n))
### BUGGY CODE ###

import fractions
n , m = map(int,input().split())
s = input()
t = input()
l = n*m//fractions.gcd(n,m)
x = ["#" for i in range(l)]
for i in range(n):
    x[i*(l//n)] = s[i]
for i in range(m):
    if x[i*(l//m)] != "#" and x[i*(l//m)] != t[i]:
        print(-1)
        exit()
print(l)

### FIXED CODE ###

import fractions
n , m = map(int,input().split())
s = input()
t = input()
l = n*m//fractions.gcd(n,m)
p = l//n
q = l//m

for i in range(10**9):
    if q*i >= n or p*i >= m:
        print(l)
        exit()
    if s[q*i] != t[p*i]:
        print(-1)
        exit()
### BUGGY CODE ###

import bisect
def main():
    X, Y, Z, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    C.sort()
    r = max(A) + max(B) + max(C)
    l = 0
    while l != r:
        k = (l + r) // 2
        t = 0
        for i in A:
            for j in B:
                ii = bisect.bisect_left(C, k-i-j)
                t += (Z - ii)
        if t > K:
            l = k
        else:
            r = k - 1
    rl = []
    for i in A:
        for j in B:
            ii = bisect.bisect_left(C, k-i-j)
            rl.extend([w+i+j for w in C[ii:]])
    rl.sort(reverse=True)
    for i in rl:
        print(i)
main()


### FIXED CODE ###

# damedatta
def binsearch(l, r, fn):
    while r - l > 1:
        m = (l + r) // 2
        if fn(m):
            l = m
        else:
            r = m
    return l
def main():
    X, Y, Z, K = map(int, input().split())
    D = sorted(map(int, input().split()), reverse=True)
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A = sorted((i + j for i in B for j in C), reverse=True)
    def calc(x):
        t = 0
        ii = len(D) - 1
        for i in A:
            while ii >= 0 and D[ii] + i < x:
                ii -= 1
            t += ii + 1
            if t >= K:
                return True
            if ii < 0:
                return False
        return t >= K
    l = binsearch(D[-1] + A[-1], D[0] + A[0]+1, calc)
    ii = len(D) - 1
    rl = []
    for i in A:
        while ii >= 0 and D[ii] + i < l + 1:
            ii -= 1
        if ii < 0:
            break
        rl.extend(i + j for j in D[:ii+1])
    rl.sort(reverse=True)
    rl += [l] * (K - len(rl))
    print('\n'.join(str(i) for i in rl))
main()
### BUGGY CODE ###

N,M = map(int,input().split()) #N個の県、M個の市
city_info = [] #要素０は０市の情報[P県、０市が誕生したY年]
Pref_info = [[] for _ in range(N)] #県P情報[要素０は０県。[市が誕生した年Y]
for i in range(M):
    P,Y = map(int,input().split())
    city_info.append([P-1, Y])
    Pref_info[P - 1].append(Y)
for i in Pref_info:
    i.sort()
    
#print("city_info = " + str(city_info))
#print("Pref_info = " + str(Pref_info))
for p,y in city_info:
    x = Pref_info[p].index(y) + 1 #市が誕生した順番を取得
    print("{0:0>6}".format(p+1) + "{0:0>6}".format(x))

### FIXED CODE ###

N,M = map(int,input().split()) 
Pref_info = [[] for _ in range(N)] 
for i in range(M):
    P,Y = map(int,input().split())
    Pref_info[P - 1].append([Y,i])
ans = [""]* M 
for i in range(N): 
    Pref_info[i].sort()
    for index, p in enumerate(Pref_info[i]):
        ans[p[1]] = "{0}{1}".format(str(i+1).zfill(6),str(index+1).zfill(6))
for i in ans:
    print(i)
### BUGGY CODE ###

n,x,y = map(int, input().split())
ans = [0]*n

for i in range(n):
    for j in range(1,n-i):
        d = min(j, abs(x-1-i)+abs(y-1-(i+j))+1, abs(x-1-(i+j))+abs(y-1-i)+1)
        ans[d] += 1

for m in range(1,n):
    print(ans[m])

### FIXED CODE ###

n,x,y = map(int, input().split())
ans = [0]*(n-1)

for i in range(n):
    for j in range(1,n-i):
        d = min(j, abs(x-1-i)+abs(y-1-(i+j))+1)
        ans[d-1] += 1

for m in range(n-1):
    print(ans[m])
### BUGGY CODE ###

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

from functools import reduce as r
from operator import mul

ans=r(mul,a)

if ans>10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

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

if 0 in a:
  print(0)
  exit()

ans=1
for x in a[::-1]:
  ans*=x
  if ans>10**18:
    print(-1)
    exit()
print(ans)
### BUGGY CODE ###

n = int(input())
p = list(map(int,input().split()))
l = []
ans = 0
for i in p:
    l.append(i)
    if min(l) == i:
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
cnt = 1
m = p[0]
for i in range(1, n):
    if p[i] <= m:
        cnt += 1
        m = p[i]
print(cnt)
### BUGGY CODE ###

from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
# import numpy as np
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10 ** -7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)


def gcd_3(x, y, z):
    return gcd(gcd(x, y), z)

K = inp()

# dic = {} # key: (i, j, k), el: gcd(i, j, k)
ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        for k in range(j, K + 1):
            a = gcd_3(i, j, k)
            if i == j == k:
                ans += a
            elif i == j or j == k:
                ans += a * 3
            else:
                ans += a * 3 * 2
print(ans)


### FIXED CODE ###

from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
# import numpy as np
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10 ** -7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)


def gcd_3(x, y, z):
    return gcd(gcd(x, y), z)

K = inp()

dic = {} # key: (i, j, k), el: gcd(i, j, k)
ans = 0
for i in range(1, K + 1):
    for j in range(i, K + 1):
        tmp = gcd(i, j)
        for k in range(j, K + 1):
            a = gcd(tmp, k)
            if i == j == k:
                ans += a
            elif i == j or j == k:
                ans += a * 3
            else:
                ans += a * 3 * 2
print(ans)
### BUGGY CODE ###

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

B = [list(map(int, input().split())) for _ in range(M)]

class Group:
    id = 0
    def __init__(self):
        self.id = Group.id
        Group.id += 1
        self.count = 1
        self.root = None

    def top(self):
        w = self
        while not w.root is None:
            w = w.root
        return w

    def union(self, g):
        ss, gg = self.top(), g.top()
        ss.count += gg.count
        gg.root = ss

pt = []
G = [Group() for x in range(N+1)]
idx = 0
cnt = 0
while len(B):
    x, y = B.pop()
    wx = G[x].top()
    wy = G[y].top()
    if wx is wy:
        pt.append(0)
    else:
        pt.append(wx.count * wy.count)
        wx.union(wy)

    #print(G)

cnt = 0
while len(pt):
    cnt += pt.pop()
    print(cnt)


### FIXED CODE ###

N, M = map(int, input().split())
B = [list(map(int, input().split())) for _ in range(M)]

pt = []
G = [[None, 1] for x in range(N+1)]

def find(x):
    n = G[x]
    c = []
    while not n[0] is None:
        c.append(n)
        n = n[0]
    for ci in c:
        ci[0] = n
    return n

cnt = 0
while len(B):
    x, y = B.pop()
    wx = find(x)
    wy = find(y)
    if wx is wy:
        pt.append(0)
    else:
        pt.append(wx[1] * wy[1])
        wx[1] += wy[1]
        wy[0] = wx

    #print(G)

cnt = 0
for _ in range(M):
    cnt += pt.pop()
    print(cnt)
### BUGGY CODE ###

c=[0]*3
c_max=0
for i in range(3):
    c[i]=list(map(int,input().split()))
    c_max=max(c_max,max(c[i]))
c_max+=1
for a1 in range(c_max):
    for a2 in range(c_max):
        for a3 in range(c_max):
            for b1 in range(c_max):
                for b2 in range(c_max):
                    for b3 in range(c_max):
                        if a1+b1==c[0][0] and a1+b2==c[0][1] and a1+b3==c[0][2] and a2+b1==c[1][0] and a2+b2==c[1][1] and a2+b3==c[1][2] and a3+b1==c[2][0] and a3+b2==c[2][1] and a3+b3==c[2][2]:
                            print('Yes')
                            exit()
print('No')


### FIXED CODE ###

c=[0]*3
c_max=0
for i in range(3):
    c[i]=list(map(int,input().split()))
    c_max=max(c_max,max(c[i]))
c_max+=1
for a1 in range(c_max):
    b1 = c[0][0] - a1
    b2 = c[0][1] - a1
    b3 = c[0][2] - a1
    a2 = c[1][0] - b1
    a3 = c[2][0] - b1
    if a1+b1==c[0][0] and a1+b2==c[0][1] and a1+b3==c[0][2] and a2+b1==c[1][0] and a2+b2==c[1][1] and a2+b3==c[1][2] and a3+b1==c[2][0] and a3+b2==c[2][1] and a3+b3==c[2][2]:
        print('Yes')
        exit()
print('No')
### BUGGY CODE ###

n = int(input())
training = 1
for i in range(1, n + 1):
    training *= i
print(training % (10 ** 9 + 7))


### FIXED CODE ###

n = int(input())
training = 1
for i in range(1, n + 1):
    training = i * training % (10 ** 9 + 7)
print(training)
### BUGGY CODE ###

X = int(input())

A = 0
while True:
    for B in range(A):
        if A ** 5 + B ** 5 == X:
            print(A, B)
            break
        if A ** 5 - B ** 5 == X:
            print(A, B)
            break
    A += 1

### FIXED CODE ###

import sys
X = int(input())

for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i**5 - j**5 == X:
            print(i,j)
            sys.exit()
### BUGGY CODE ###

import numpy as np
n, m = map(int, input().split())
money = []
for i in range(n):
  a, b = map(int, input().split())
  money += [a] * b

money = sorted(money)
print(sum(money[0:m]))

### FIXED CODE ###

n, m = map(int, input().split())
money = []
for i in range(n):
  a, b = map(int, input().split())
  money.append({"a":a, "b":b})

bsum = 0
money.sort(key=lambda x: x["a"])
for i in range(n):
  bsum0 = bsum
  bsum += money[i]["b"]
  if m <= bsum:
    num = i
    break

ans = 0
for j in range(num):
  ans += money[j]["a"] * money[j]["b"]
ans += (m-bsum0) * money[num]["a"]
print(ans)
### BUGGY CODE ###

s = input()
n = len(s)
xy = tuple(map(int, input().split()))

dp = [set() for j in range(n+1)]

dp[0].add((0,0,0))

for i in range(n):
    if s[i]=='F':
        for x,y,z in dp[i]:
            if abs(xy[0]-x)+abs(xy[1]-y)>n-i:
                continue
            if z==0:
                dp[i+1].add((x+1,y,z))
            elif z==1:
                dp[i+1].add((x,y+1,z))
            elif z==2:
                dp[i+1].add((x-1,y,z))
            else:
                dp[i+1].add((x,y-1,z))
    else:
        for x,y,z in dp[i]:
            if abs(xy[0]-x)+abs(xy[1]-y)>n-i:
                continue
            if z==0:
                dp[i+1].add((x,y,1))
                dp[i+1].add((x,y,3))
            elif z==3:
                dp[i+1].add((x,y,0))
                dp[i+1].add((x,y,2))
            else:
                dp[i+1].add((x,y,z-1))
                dp[i+1].add((x,y,z+1))

for x,y,z in dp[n]:
    if xy == (x,y):
        print('Yes')
        exit()

print('No')

### FIXED CODE ###

s = input()
n = len(s)
xy = list(map(int, input().split()))

right = 0
updown = []
rightleft = []

direction = 0
for i in range(n):
    if s[i]=='F':
        if direction == 0:
            right+=1
        elif direction == 1:
            updown[-1]+=1
        else:
            rightleft[-1]+=1
    else:
        if direction == 0 or direction == 2:
            direction = 1
            updown.append(0)
        else:
            direction = 2
            rightleft.append(0)

updown = [x for x in updown if x!=0]
rightleft = [x for x in rightleft if x!=0]

# 最初はx方向にしか進めないので補正
xy[0]-=right

# updownでyに行けるか？rightleftでxに行けるかを考えれば良い
dpy = [set() for i in range(len(updown)+1)]
dpy[0].add(0)
for i in range(len(updown)):
    for y in dpy[i]:
        dpy[i+1].add(y+updown[i])
        dpy[i+1].add(y-updown[i])

dpx = [set() for i in range(len(rightleft)+1)]
dpx[0].add(0)
for i in range(len(rightleft)):
    for x in dpx[i]:
        dpx[i+1].add(x+rightleft[i])
        dpx[i+1].add(x-rightleft[i])

if xy[1] in dpy[-1] and xy[0] in dpx[-1]:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**9)
    from sys import stdin
    def input() : return stdin.readline().rstrip()
    N,M = map(int,input().split())
    dist = [-1] * N
    G = dict()
    for i in range(N):
        G[i] = []   
    for _ in range(M):
        a,b = map(int,input().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    q = [0]
    pre = [0] * N
    dist[0] = 0
    while (q != []):
        v = q[0]
        q.remove(q[0])
        for vertex in G[v]:
            if dist[vertex] != -1:
                continue
            dist[vertex] = dist[v] + 1
            pre[vertex] = v
            q.append(vertex)
    print("Yes")
    for v in range(1,N): 
        print(pre[v]+1)
if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**9)
    from sys import stdin
    def input() : return stdin.readline().rstrip()
    N,M = map(int,input().split())
    dist = [-1] * N
    G = dict()
    for i in range(N):
        G[i] = []   
    for _ in range(M):
        a,b = map(int,input().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    q = [0]
    pre = [0] * N
    dist[0] = 0
    while (q != []):
        v = q[0]
        q.remove(q[0])
        for vertex in G[v]:
            if dist[vertex] != -1:
                continue
            dist[vertex] = dist[v] + 1
            pre[vertex] = v
            q.append(vertex)
    print("Yes")
    for v in range(1,N): 
        print(pre[v]+1)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

ans=[]
for i in range(n//2,n):
  if li[i]==1:
    ans.append(i+1)
ans.reverse()
for i in range(n//2,0,-1):
  count=0
  for j in ans:
    if j%i==0:
      count+=1
  count+=li[i-1]
  if count%2==1:
    ans.append(i)
ans.reverse()
print(len(ans))
L=[str(a) for a in ans]
L=" ".join(L)
if len(L)!=0:
  print(L)

### FIXED CODE ###

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

ans=[]
li2=[0 for _ in range(n)]
for i in range(n,0,-1):
  count=0
  for j in range(i*2,n+1,i):
    if li2[j-1]==1:
      count+=1
  if count%2!=li[i-1]:
    li2[i-1]=1
    ans.append(i)

ans.reverse()
print(len(ans))
L=[str(a) for a in ans]
L=" ".join(L)
if len(L)!=0:
  print(L)
### BUGGY CODE ###

def flip(s):
    return list(reversed(s))

def add(s,ql):
    if ql[1] == "1":
        return list(ql[2])+s
    elif ql[1] == "2":
        return s+list(ql[2])
        
def string_formation(s,q,ql):
    for i in range(len(ql)):
        br = ql[i][0]
        #print(br)
        if br == "1":
            s = flip(s)
            #print(s)
        elif br == "2":
            s = add(s,ql[i])
            #print(s)
    return s

if __name__ == '__main__':
    s = input()
    q = int(input())
    ql = [list(input().split()) for _ in range(q)]

    #print(s)
    #print(q)
    #print(ql)
    
    ans = string_formation(list(s),q,ql)
    print(''.join(ans))


### FIXED CODE ###

from collections import deque

def msf(s,queries):
    queue = deque(s)
    addl = queue.appendleft
    addr = queue.append
    is_reversed = 0

    for query in queries:
        if query[0] == '1':
            is_reversed ^= 1
            addl,addr = addr,addl
        elif query[0] == '2':
            f = query[1]
            c = query[2]
            if f == '1':
                addl(c)
            elif f == '2':
                addr(c)
    return ''.join(queue) if not is_reversed else ''.join(reversed(queue))

if __name__ == '__main__':
    s = list(input())
    q = int(input())
    ql = [input().split() for i in range(q)]
    print(msf(s,ql))
### BUGGY CODE ###

N = int(input())
ans = 0
for i in range(1, N):
    temp = N-i
    j = 1
    low = []
    up = []
    while j**2<=temp:
        if temp%j==0:
            low.append(j)
            if j!=temp//j:
                up.append(temp//j)
        j+=1
    ans+=len(low+up[::-1])
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
temp = N-1
for i in range(1, N):
    j = temp//i
    ans+=j
print(ans)
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

T = S()

def match(v):
    return int(v) % 2019 == 0

cnt = 0

M = {}
for i in range(0, len(T)):
    for j in range(i+1, len(T)+1):
        s = T[i:j]
        if s in M:
            cnt += 1
            continue

        if match(s):
            M[s] = True
            cnt += 1

print(cnt)

### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

T = S()

revT = reversed(T)

n, d, mods = 0, 1, [1]+[0]*2019

for i in revT:
    n = (n + int(i)*d)%2019
    d = d*10%2019
    mods[n] += 1

sum = 0
for j in mods:
    sum += j*(j-1)//2

print(sum)