Harryxun/stf_run huggingface dataset:
n = int(input())
a = list(map(int,input().split()))
m = max(a)
li = [0]*m 
for x in a:
    li[x] += 1
ans = 0
for i in range(1,m):
    if li[i]: 
        if li[i]==1: 
            ans += 1 
        for j in range(i,m,i): 
            li[j] = 0
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
m = max(a) + 10
li = [0]*m 
for x in a:
    li[x] += 1
ans = 0
for i in range(1,m):
    if li[i]: 
        if li[i]==1: 
            ans += 1 
        for j in range(i,m,i): 
            li[j] = 0
print(ans)
Alp=input()
if Alp.isupper() = True :
	print('A')
  else:
	print('a')

### FIXED CODE ###

Alp = input()
if Alp.isupper() == True :
  print('A')
else:
  print('a')
from sys import stdin
a = [0,2,1]
for i in xrange(3,80):
 a.append(a[-1] + a[-2])
print a[int(stdin.readline())]

### FIXED CODE ###

from sys import stdin
a = stdin.readline().strip()
ans = 'No'
b = a[:3]
c = a[1:]
if b==a[0]*3:
 ans = 'Yes'
if c==a[1]*3:
 ans = 'Yes'
print ans
= list(input())
b = [int(i) for i in a]
c=sorted(b,reverse=True)
d =10*c[0]+c[1]+c[2]
print(d)

### FIXED CODE ###

a = input().split()
b = [int(i) for i in a]
c=sorted(b,reverse=True)
d =10*c[0]+c[1]+c[2]
print(d)
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    #ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)!=1:
    print(0)
else:
    print(ans)


### FIXED CODE ###

n=int(input())
if n%2 == 0:
    print((n>>1)-1)
else:
    print(n>>1)
# 入力
x, a, b = map(int, input().split())

# 処理
left = x - a
b_quantity = left // b
b_price = b * b_quantity
answer = left - b_price

# 出力
print(answer)

### FIXED CODE ###

X = int(input())
A = int(input())
B = int(input())

print((X - A) % B)
import sys

lists = sys.stdin().readlines()

for i, int(line) in enumerate(lists):
 if(line[i]!=0):
  print "Case %d: %d" % (i, line[i])
 else:
  break

### FIXED CODE ###

import sys

i = 1

while(1):
    a = raw_input()
    if('0'==a):
        break
    else:
        print "Case %d: %s" % (i, a)
        i += 1
import sys
input = sys.stdin.readline
from collections import deque

mod = 10**9 + 7

n,k = map(int,input().split())
edges = {}
d = [0] * (n+1)
for i in range(1,n+1):
    edges[i] = []

for i in range(n-1):
    a,b = map(int,input().split())
    edges[a].append(b)
    edges[b].append(a)
    d[a] += 1
    d[b] += 1

for i in range(1,n+1):
    if(d[i] == 1):
        first = i
        break

d = [0] * (n+1)
d[0] = -1
d[first] = -1
dq = deque()
dq.appendleft([0,first])

ans = 1
while(len(dq) > 0):
    parent, child = dq.pop()
    d[parent] += 1
    d[child] += 1
    ans = ans * (k - d[parent]) % mod

    for i in edges[child]:
        if(i != parent):
            dq.appendleft([child, i])

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque

mod = 10**9 + 7

n,k = map(int,input().split())
if(n == 1):
    print(k)
    exit()


edges = {}
d = [0] * (n+1)
for i in range(1,n+1):
    edges[i] = []

for i in range(n-1):
    a,b = map(int,input().split())
    edges[a].append(b)
    edges[b].append(a)
    d[a] += 1
    d[b] += 1

for i in range(1,n+1):
    if(d[i] == 1):
        first = i
        break

d = [0] * (n+1)
d[0] = -1
d[first] = -1
dq = deque()
dq.appendleft([0,first])

ans = 1
while(len(dq) > 0):
    parent, child = dq.pop()
    d[parent] += 1
    d[child] += 1
    ans = ans * (k - d[parent]) % mod

    for i in edges[child]:
        if(i != parent):
            dq.appendleft([child, i])

print(ans)
n=int(input())
d=dict()
if n==1:
  print(1)
else:
  for i in range(2,n+1):
    for j in range(2,i+1):
      if i%j==0:
        if j not in d:
          d[i]=1
        else:
          d[i]+=1
  ans=1
  for i in d.values():
    ans*=i+1

### FIXED CODE ###

n=int(input())
d=dict()
for i in range(1,n+1):
  for j in range(1,i+1):
    if j==1:
      continue
    while i%j==0:
      if j not in d:
        d[j]=1
      else:
        d[j]+=1
      i//=j
ans=1
for i in d.values():
  ans*=i+1
print(ans%1000000007)
S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'STA':1, 'SUN':7}

s = input()
print(S[s])

### FIXED CODE ###

S = {'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1, 'SUN':7}

s = input()
print(S[s])
print(''.join(sorted(S+T)))

### FIXED CODE ###

s,t = input().split()
print(t.lower() + s.lower())
N = inT(input())
A = list(map(int, input()))
B = list(map(int, input()))
C = list(map(int, input()))

print(sum(B))
print(C)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
bonus = 0

for i in range(N-1):
  if A[i+1]==A[i]+1:
    bonus+=C[A[i]-1]

print(sum(B)+bonus)
N = int(input())
AL = list(map(int, input().split()))

s = "APPROVED"
for i in AL:
  if i%2 == 0 and i%3 != 0 and i%5 != 0:
    s = DENIED
print(s)

### FIXED CODE ###

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

s = "APPROVED"
for i in AL:
  if i%2 == 0 and i%3 != 0 and i%5 != 0:
    s = "DENIED"
print(s)
n,m = map(int,input().split())

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



def solve(n,now,ls,cnt):
    if n == now:
        return cnt
    elif n-1 == now:
        return cnt
    else:
        pass

    if now+1 in ls and now+2 in ls:
        return 0
    elif   now+1 in ls:
        return solve(n,now+2,ls,cnt)
    elif   now+2 in ls:
        return solve(n,now+1,ls,cnt)
    else:
        return solve(n,now+2,ls,cnt*2)

ans = solve(n,0,a,1)

print(ans%(1000000007))

### FIXED CODE ###

n,m = map(int,input().split())
ls = set()
for i in range(m):
    ls.add(int(input()))
dp = [0]*(n+1)
dp[0]=1
if 1 in ls:
    dp[1]= 0
else:
    dp[1]= 1
for i in range(2,n+1):
    if i in ls :
        continue
    dp[i] = dp[i-1]+dp[i-2]
print(dp[n]%(10**9+7))
N = int(input()) 
A = list(map(int,input().split()))
c = 1
for i in N-1:
  c *= A[i]
  if c >= 10**18:
    print(-1)
  
print(c)



### FIXED CODE ###

n=int(input())
ls=[int(s) for s in input().split(" ")]

if 0 in ls:
  print(0)
else:
  num=1
  for i in ls:
    num*=i
    if num>10**18:
      num=-1
      break

  print(num)
args=input().split()
n=int(args[0])
s=args[1]

if n % 2 == 1:
  print('No')
elif s[n/2:]!=s[:n/2]:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

n = int(input())
s = input()
if n % 2:
    print("No")
    exit()
half = s[0:n // 2]
print("Yes" if s == half + half else "No")
l=int(input())
v=float((l/3)**3)
print(f'{v:.18e}')

### FIXED CODE ###

l=int(input())
v=float((l/3)**3)
print(v)
x,y = map(int,input().split())
z = 2*x + y/2
if (z - floor(z) == 0):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

from math import floor
x,y = map(int,input().split())
for i in range(0,x+1):
    if (2*(i) + 4*(x-i) == y):
        print("Yes")
        exit(0);
print("No")
target = input()
text = input()
text = input()
text = input()
text = input()
#text = input()
text2 = text.replace('\n',' ')
sentenceList = text2.split()
count = 0
for word in sentenceList:
 if(word.lower() == target):
  count+=1
print(count)


### FIXED CODE ###

target = input()
total_text = ""
while True:
 text = input()
 if(text=="END_OF_TEXT"):
  break
 total_text+=" "
 total_text+=text
#text2 = text.replace('\n',' ')
sentenceList = total_text.split()
count = 0
for word in sentenceList:
 if(word.lower() == target):
  count+=1
print(count)
x, a = map(int. input().split())
print(0 if x < a else 10)

### FIXED CODE ###

x, a = map(int, input().split())
print(0 if x < a else 10)
S = input().strip()
k = int(input())
for i, c in enumerate(S, 1):
  if c != '1' or i == k:
print(c)

### FIXED CODE ###

S = input().strip()
k = int(input())
for i, c in enumerate(S, 1):
  if c != '1' or i == k:
    break
print(c)
import sys
input = sys.stdin.readline

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

for i in range(1,N+1):
    for j in range(N-1):
        a,b = sorted([i,A[i-1][j]])

        A[i-1][j] = a*(N-1)+b-N-1

E=[set() for i in range(N*N)]
EREV=[set() for i in range(N*N)]

for i in range(N):
    for j in range(1,N-1):
        E[A[i][j-1]].add(A[i][j])
        EREV[A[i][j]].add(A[i][j-1])

from collections import deque
Q=deque()

H=[0]*N**N

for i in range(N*N):
    if E[i]==set() and len(EREV[i])>0:
        Q.append(i)
        H[i]=1

while Q:
    x=Q.pop()

    for fr in EREV[x]:
        H[fr]=max(H[x]+1,H[fr])
        if H[fr]>N*N:
            print(-1)
            sys.exit()
        Q.append(fr)
        

if max(H)==0:
    print(-1)
else:
    print(max(H))


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

for i in range(1,N+1):
    for j in range(N-1):
        a,b = sorted([i,A[i-1][j]])

        A[i-1][j] = a*(N-1)+b-N-1

E=[[] for i in range(N*N)]
EREV=[[] for i in range(N*N)]

EDGEIN=[0]*(N*N)

for i in range(N):
    for j in range(1,N-1):
        E[A[i][j-1]].append(A[i][j])
        EREV[A[i][j]].append(A[i][j-1])
        EDGEIN[A[i][j]]+=1

from collections import deque
Q=deque()

for i in range((N-1)**2):
    if EDGEIN[i]==0 and len(E[i])>0:
        Q.append(i)

TOP=[]
while Q:
    x=Q.pop()
    TOP.append(x)
    for to in E[x]:
        EDGEIN[to]-=1
        if EDGEIN[to]==0:
            Q.append(to)


H=[1]*(N**2)
for x in TOP[::-1]:

    for fr in EREV[x]:
            
        if H[fr]<H[x]+1:
            H[fr]=H[x]+1

if min(EDGEIN)<0 or max(EDGEIN)>0:
    print(-1)
else:
    print(max(H))
#coding:utf-8
s=[int(i) for i in input().split()]
n=[]
for i in range(s[0]):
  n.append(int(input()))
n.sort()
sa=abs(n[0]-n[s[1]]-1)
for i in range(s[1]):
  print(n[1],n[i+s[1]-1])
  if(sa>abs(n[i]-n[i+s[1]-1])):
    sa=abs(n[i]-n[i+s[1]-1])
print(sa)

### FIXED CODE ###

n=[int(i) for i in input().split()]
array=[]
for i in range(n[0]):
  array.append(int(input()))
array.sort()
ans=abs(array[0]-array[n[1]-1])
for i in range(n[0]-(n[1]-1)):
  if(ans>abs(array[i]-array[i+n[1]-1])):
    ans=abs(array[i]-array[i+n[1]-1])
print(ans)
t1,t2=map(int,input().split())
a1,a2=map(int,input().split())
b1,b2=map(int,input().split())
a=t1*(a1-b1)
b=t2*(a2-b2)
if a+b==0:print("infinity");exit()
if a*b>=0:print(0);exit()
x,y=abs(a-b),abs(a+b)
print(x,y)
print(int(0--(x)//y)-0.5)-1)

### FIXED CODE ###

t1,t2=map(int,input().split())
a1,a2=map(int,input().split())
b1,b2=map(int,input().split())
x=(a1-b1)*t1
y=(a2-b2)*t2
if x>0:
  x*=-1
  y*=-1
if x+y<0:print(0)
elif x+y==0:print("infinity")
else:
  ans=(-x)//(x+y)
  if (-x)%(x+y):print(ans*2+1)
  else:print(ans*2)
n,x=map(int,input().split())
A=list(map(int,input().split()))
ans=0
dp=[[A[i]]*n for i in range(n)]
for l in range(n):
  a=A[l:]+A[:l]
  a=a[::-1]
  for i in range(n):
    dp[l][i+1]=min(dp[l][i],a[i]+x*(i+1))
print(sum(map(lambda x:x[-1], dp)))


### FIXED CODE ###

n,x=map(int,input().split())
A=list(map(int,input().split()))
ans=float("INF")
dp=[[A[i]]*n for i in range(n)]
for l in range(n):
  a=A[l:]+A[:l]
  a=a[::-1]
  for i in range(n-1):
    dp[l][i+1]=min(dp[l][i],a[i])
for i in range(n):
  tmp=0
  for j in range(n):
    tmp+=dp[j][i]
  ans=min(tmp+x*i,ans)
print(ans)
n=int(input())
s=0
for i in range(n):
    for j in range(i):
        a=0
        if i%j==0:
            a+=1
    if a==8:
        s+=1
print(s)

### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n=int(input())
#print(make_divisors(n))
s=0
for i in range(1,n+1,2):
    if len(make_divisors(i))==8:
        s+=1
print(s)
while True:
  h, w = map(int, raw_input().split())
  if (h == 0 and w == 0):
    break
  for i in range(0,h):
    for j in range(0,w):
      if i == 0 or j == 0 or i == h-1 or j == w-1:
        print ("#")
      else: 
        print (".")
    print("\n)
  

### FIXED CODE ###

while True:
  h, w = map(int, raw_input().split())
  if (h == 0 and w == 0):
    break
  for i in range(0,h):
    if i == 0 or i == h-1:
      print ('#' * w)
    else: 
      print ('#' + '.' * (w - 2) + '#' )
  print
a,b,c=map(str,input().split())
s="{}{}{}".format(a,b,c)
print(int(s))

### FIXED CODE ###

print(eval(input()))
n = int(input())
A = list(map(int, input().split()))
q = int(input())
mi = map(int, input().split())

def solve(i, m):
    if (m == 0):
        return True
    if (i >= n):
        return False
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    return res

for i in q:
    if solve(0, mi):
        print("yes")
    else:
        print("no")

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
q = int(input())
mi = map(int, input().split())
t = {}

def solve(i, m):
    if (m == 0):
        return True
    if (i >= n):
        return False
    if (i,m) in t:
        return t[(i,m)]
    res = solve(i + 1, m) or solve(i + 1, m - A[i])
    t[(i,m)] = res
    return res

for m in mi:
    if solve(0, m):
        print("yes")
    else:
        print("no")
from fractions import gcd

n, m = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]

a = set(a)
a = list(map(lambda x: x/2, a))
mp = a[0]
g= a[0]

for i in range(1,len(a)):
    g = gcd(g,a[i])
    mp = a[i] * mp

hlcm = int(mp/g)

if hlcm % 2 == 1:
    ans = m // hlcm - (m // (hlcm*2))
else:
    ans = 0

print(ans)

### FIXED CODE ###

import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from fractions import gcd

    n, m = list(map(int, readline().split()))
    a = list(map(int, readline().split()))
    cnt = [0] * n

    for i, elem in enumerate(a):
        x = elem
        c = 0
        while x % 2 == 0:
            x //= 2
            c += 1
        cnt[i] = c

    ans = 0

    if len(set(cnt)) == 1:
        lcm = a[0]
        for elem in a[1:]:
            lcm = (lcm * elem) // gcd(lcm, elem)
        ans = (m + (lcm // 2)) // lcm

    print(ans)


if __name__ == '__main__':
    main()
p=int(input())
a=input()
b=[]
for i in range(1,p-1):
    c=0
    t=list(set(a[:i]))
    k=a[i:]
    for j in range(len(t)):
        if t[j]in k:
            c+=1
    b.append(c)
print(max(b))

### FIXED CODE ###

p=int(input())
a=input()
b=[]
for i in range(0,p):
    c=0
    t=list(set(a[:i]))
    k=a[i:]
    for j in range(len(t)):
        if t[j]in k:
            c+=1
    b.append(c)
print(max(b))
import sys
L,R=map(int, sys.stdin.readline().split())
sho1=L/2019
sho2=R/2019
if 1<=sho2-sho1:
    print 0
else:
    ans=float("inf")
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans=min(ans,i*j%2019)

print ans

### FIXED CODE ###

L,R=map(int, raw_input().split())
a=L%2019
b=R%2019

T=[]
ans=float("inf")
if a<b:
	T=range(a,b+1)
	if R-L>2018:
		print 0
		quit()
	else:
		l=len(T)
		for i in range(l):
			for j in range(i+1,l):
				ans=min(ans, (T[i]*T[j])%2019 )

		print ans
else:
	print 0
	quit()
from math import modf

n, a, b, c, d, e = [int(input()) for _ in range(6)]

dif = 0
ss = [a,b,c,d,e]
for i in range(N-1):
  if ss[i] > ss[i+1]:
    dif += ss[i]-ss[i+1]
dd, ii = modf(n/max(dif, min(ss)))
print(max(5, int(ii)+int(dd*10)))

### FIXED CODE ###

n, a, b, c, d, e = [int(input()) for _ in range(6)]
x = min(a,b,c,d,e)
print((n+x-1)//x+4)
n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = set(range(n))

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)

def Preorder(i):
    if (i == -1):
        return
    print(" {}".format(i), end = "")
    Preorder(left[i])
    Preorder(right[i])
      
def Inorder(i):
    if (i == -1):
        return
    Inorder(left[i])
    print(" {}".format(i), end = "")
    Inorder(right[i])
      
def Postorder(i):
    if (i == -1):
        return
    Postorder(left[i])
    Postorder(right[i])
    print(" {}".format(i), end = "")

print("Preorder")
Preorder(root)
print()
  
print("Inorder")
Inorder(root)
print()
  
print("Postorder")
Postorder(root)
print()

### FIXED CODE ###

n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = sum(range(n)) - n - 1

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)

def Preorder(i):
    if (i == -1):
        return
    print(" {}".format(i), end = "")
    Preorder(left[i])
    Preorder(right[i])
      
def Inorder(i):
    if (i == -1):
        return
    Inorder(left[i])
    print(" {}".format(i), end = "")
    Inorder(right[i])
      
def Postorder(i):
    if (i == -1):
        return
    Postorder(left[i])
    Postorder(right[i])
    print(" {}".format(i), end = "")

print("Preorder")
Preorder(root)
print()
  
print("Inorder")
Inorder(root)
print()
  
print("Postorder")
Postorder(root)
print()
x=int(input())
    for a in range(-118,120):
        for b in range(-118,120):
            if a**5-b**5==x:
                print(a,b)
                exit()

### FIXED CODE ###

x=int(input())
for a in range(-118,120):
    for b in range(-118,120):
        if a**5-b**5==x:
            print(a,b)
            exit()
a,b = map(int(input().split()))
print(a*b)

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
import sys

def main():
    data = input()
    flds = data.split(" ")
    N = int(flds[0])
    K = int(flds[1])

    count = 0
    for i in range(1, N):
        if i + K - 1 <= N:
#           print("%d -  %d" %(i, i + K - 1))
            count += 1

#   print("resut = " %count)
   print(count)

if __name__ == "__main__":
    main()


### FIXED CODE ###

N, K = map(int,input().split())
print(N - K + 1)
import sys
Input = list(map(int, sys.stdin))
N = Input[0]
a = Input[1:N]
isFound = False
ai = 1
for i in range(1, N + 1):
    ai = a[ai - 1]
#    print(f'a{i} = {ai}')
    if (ai == 2):
        isFound = True
        print(i)
        break
if (isFound is False):
    print(-1)


### FIXED CODE ###

N = int(input())
a = [int(input()) for i in range(N)]
isFound = False
ai = 1
for i in range(1, N + 1):
    ai = a[ai - 1]
#    print(f'a{i} = {ai}')
    if (ai == 2):
        isFound = True
        print(i)
        break
if (isFound is False):
    print(-1)
[a, b, h, m] = map(int, input())
 
import math
 
long_n = math.radians((h*60 + m) / (12 * 60))
short_n = math.radians((m) / 60)
 
y1 = a * math.sin(long_n)
x1 = a * math.cos(long_n)
 
y2 = b * math.sin(short_n)
x2 = b * math.cos(short_n)
 
print(math.sqrt((x2 - x1) **2+ (y2 - y1) **2))

### FIXED CODE ###

[a, b, h, m] = map(int, input().split(' '))
 
import math

long_n = math.radians(h * 30 + 30 * (m / 60))
short_n = math.radians(360 / 60 * m)
 
y1 = a * math.sin(long_n)
x1 = a * math.cos(long_n)
 
y2 = b * math.sin(short_n)
x2 = b * math.cos(short_n)
 
print(math.sqrt((x2 - x1) **2+ (y2 - y1) **2))
S = input()
L = len(input())
dp = [[0] * 13 for _ in range(L+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
for i in range(L):
  if S[i] == '?':
    for j in range(10):
      for k in range(13):
        dp[i][(k*10+j)%13] += dp[i][j]
  else:
    for k in range(13):
      dp[i][(k*10+int(i))%13] += dp[i][j]
print(dp[L][5]

### FIXED CODE ###

S = input()
l = len(S)
dp = [[0] * 13 for _ in range(l+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
mul = 1
for i in range(l):
    if S[-(i+1)] == '?':
        for j in range(10):
            for k in range(13):
                dp[i+1][(j * mul + k) % 13] += dp[i][k]
                dp[i+1][(j * mul + k) % 13] %= MOD
    else:
        j = int(S[-(i+1)])
        for k in range(13):
            dp[i+1][(j * mul + k) % 13] += dp[i][k]
            dp[i+1][(j * mul + k) % 13] %= MOD
    mul = mul * 10 % 13
print(dp[l][5])
n = input()
from itertools import product
from collectins import Counter
sum = 0
for i in range(len(n)-2):
  for j in product("753", repeat=i+3):
    if int(''.join(j)) <= int(n) and len(Counter(j))==3:
      sum+=1
print(sum)

### FIXED CODE ###

n = input()
from itertools import product
sum = 0
for i in range(len(n)-2):
  for j in list(product("753", repeat=i+3)):
    if int(''.join(j)) <= int(n) and len(set(j))==3:
      sum+=1
print(sum)
import math
N,K=map(int,input().split())
pro=0
if N>=K:
    pro+=(N-K)/N
    for k in range(1, K):
        r = math.ceil(math.log2(K / k))
        pro += 0.5**r / N
else:
    for k in range(1, N+1):
        r = math.ceil(math.log2(K / k))
        pro += 0.5**r / N
print(pro)


### FIXED CODE ###

import math
N,K=map(int,input().split())
pro=0
if N==1 and K==1:
    print(1)
elif N>=K:
    pro+=(N-K+1)/N
    for k in range(1, K):
        r = math.ceil(math.log(K / k,2))
        pro += 0.5**r / N
    print(pro)

else:
    for k in range(1, N+1):
        r = math.ceil(math.log(K / k,2))
        pro += 0.5**r / N
    print(pro)
s = list(map(int,input().split()))

if s[0] <= s[1]:
    print(s[0]*s[2])
else:
    atamakin = s[1]*s[2]
    nokori = (s[0]-s[1])*s[3]
    print(atamakin + nokori)

### FIXED CODE ###

n, k, x, y = [int(input()) for i in range(4)]
if n > k:
    syogaku = k * x
    sagaku = (n - k) * y
    print(syogaku + sagaku)
else:
    syogaku = n * x
    print(syogaku)
import sys

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

# 座標数よりコマ数が多ければ初期位置で条件を満たす
if N > M:
    print(0)
    sys.exit()

# ソートする
X.sort()

# 隣り合う数の差を計算する
diff = list()
for m in range(M-1):
    diff.append(X[m+1] - X[m])

total = 0
for n in range(N-1):
    max_index = diff.index(max(diff))
    left = 0
    right = 0
    for l in range(len(diff)):
        if l < max_index:
            left += diff[l]
        elif l > max_index:
            right += diff[l]
    if left > right:
        diff = diff[:max_index]
        total += right
    else:
        diff = diff[max_index+1:]
        total += left

total += sum(diff)
print(total)

### FIXED CODE ###

import sys

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

# 座標数よりコマ数が多ければ初期位置で条件を満たす
if N >= M:
    print(0)
    sys.exit()

# ソートする
X.sort()

# 隣り合う数の差を計算する
diff = list()
for m in range(M-1):
    diff.append(X[m+1] - X[m])

diff.sort(reverse=True)
print(sum(diff[N-1:]))
seq = raw_input()

total = int(0)
for i in range(1, int(seq)+1, 1):
    if ((i % 3) != 0) and ((i % 5) != 0):
        total = total + i
print(total)


### FIXED CODE ###

seq = int(input())

total = int(0)
for i in range(1, seq+1, 1):
    if ((i % 3) != 0) and ((i % 5) != 0):
        total = total + i
print(total)
a = int(input())
b = list(int,input().split())
c = 1/b[0]
for i in range(len(b)-1):
  c = c + 1/b[i]
print(1/c)

### FIXED CODE ###

a = int(input())
b = list(map(int,input().split()))
c = 0
for i in range(a):
  c += 1/b[i]
print(1/c)
from math import gcd
a, b = map(int, input().split())

print(a * b // gcd(a, b))

### FIXED CODE ###

from fractions import gcd
a, b = map(int, input().split())

print(a * b // gcd(a, b))
a = list(map(int, input()))

print("{} {}".format(a[0]*a[1], 2*sum(a)))


### FIXED CODE ###

a, b = map(int, input().split())
l = 2*(a+b)
s = a*b
print("{} {}".format(s, l))
S = input()
n = lens(S)

def dfs(i,k):
  if i == n-1:
    return(sum(list(map(int,f.split("+")))
  return dfs(i+1,K+S[i+1])+dfs(i+1,K+"+"+S[i+1])
print(dfs(0,S[0])
               


### FIXED CODE ###


S = input()
n = len(S)
 
def dfs(i, k):
    
    if i == n-1:
        return sum(list(map(int,k.split("+"))))
    
    return dfs(i+1,k+S[i+1])+dfs(i+1,k+"+"+S[i+1])
 
print(dfs(0,S[0]))