CodeEff/ECCO huggingface dataset:
# Original solution
def fun(n):
    if n%2!=0:
        return 0
    else:
        ans=0
        n//=2
        while(n):
            ans=ans+n//5
            n=n//5
    return ans


n = int(eval(input()))
if n>=2:
    print((fun(n)))
else:
    print((0))


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
 
n1 = int(readline())
if n1 % 2 == 1:
    print((0))
else:
    n1 //= 2
    ans = 0
    while n1:
        n1 //= 5
        ans += n1
    print(ans)
# Original solution
N = int(eval(input()))

if N % 2 == 1:
    print((0))
    exit(0)

n = 10
ans = 0
while True:
    if n > N:
        break
    ans += N//n
    n *= 5

print(ans)

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

def solve_function(N):
    if N % 2 == 1:
        return 0

    n = 10
    ans = 0
    while True:
        if n > N:
            break
        ans += N//n
        n *= 5
    return ans

if solve_function(N):
    print((solve_function(N)))
else:
    print((0))
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return eval(input())

# 2*5 の数が末尾の0の数
# nが奇数だと素因数2は出現しないので0
# 偶数の場合のみ考える
# （掛け合わせる数は全て偶数なので（これって理由になってる？））素因数は2よりも5の方が少ない
# 素因数5の数をカウントする
# （2*5で割れる個数）+（2*25で割れる個数）＋... が答え（2をかけているのは偶数前提なので）

def main():
  n=I()

  if n%2!=0:
    return 0

  a=2
  ans=0
  while True:
    a*=5
    if a>n:
      return ans
    ans+=n//a

# main()
print((main()))


# Optimized solution
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return eval(input())

def main():
  n=I()
  if n%2==1 or n<10:
    return 0

  st=10
  ans=[]
  while st<=n:
    ans.append(n//st)
    st*=5

  return sum(ans)

# main()
print((main()))
# Original solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    if N % 2:
        print((0))
        return

    N //= 10
    ans = N
    while N:
        N //= 5
        ans += N

    print(ans)
    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    if N % 2:
        print((0))
        return

    ans = 0
    N //= 2
    while N:
        N //= 5
        ans += N

    print(ans)
    return


if __name__ == '__main__':
    main()
# Original solution
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(eval(input()))
    if N < 2:
        print((0))
        return
    if N % 2 == 1:
        print((0))
        return
    n = 2
    cnt = 0
    while n * 5 <= N:
        n *= 5
        cnt += 1
    ans = 0
    for _ in range(cnt):
        ans += N // n
        n //= 5
    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(eval(input()))

    def F(N):
        if N & 1:
            return 0
        N //= 2
        x = 0
        while N:
            N //= 5
            x += N
        return x

    answer = F(N)
    print(answer)


if __name__ == "__main__":
    main()
# Original solution
n, k = list(map(int, input().split()))
*A, = list(map(int, input().split()))

MOD = 10**9 + 7

C = {a for a in A}
n = len(C)
m = [[0]*256 for i in range(n+1)]
m[0][0] = 1
for c in C:
    for i in range(n-1, -1, -1):
        for j in range(256):
            m[i+1][c^j] += m[i][j]
            m[i+1][c^j] %= MOD

ans = 0
r = 1
for i in range(1, n+1):
    r = (r * i) % MOD
    ans += r * m[i][k]
    ans %= MOD
print(ans)

# Optimized solution
n, k = list(map(int, input().split()))
*A, = list(map(int, input().split()))

MOD = 10**9 + 7

C = {a for a in A}
n = len(C)
m = [[0]*256 for i in range(n+1)]
m[0][0] = 1
for c in C:
    for i in range(n-1, -1, -1):
        s = m[i]; t = m[i+1]
        for j in range(256):
            t[c^j] += s[j]

ans = 0
r = 1
for i in range(1, n+1):
    r = (r * i) % MOD
    ans += r * m[i][k]
    ans %= MOD
print(ans)
# Original solution
from itertools import chain
n=int(eval(input()))
c=list(range(1,1+2*n))
for _ in[0]*int(eval(input())):
    k=int(eval(input()))
    c=c[k:]+c[:k]if k else list(chain.from_iterable(x for x in zip(c[:n],c[n:])))
for x in c:print(x)


# Optimized solution
from itertools import chain
n=int(eval(input()))
c=list(range(2*n))
for _ in[0]*int(eval(input())):
    k=int(eval(input()))
    c=c[k:]+c[:k]if k else list(chain.from_iterable(list(zip(c[:n],c[n:]))))
for x in c:print((x+1))
# Original solution
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513

"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline


def flatten(listOfLists):
    "Flatten one level of nesting"
    return chain.from_iterable(listOfLists)


def cut(k):
    global cards
    yellow = cards[:k]
    blue = cards[k:]
    cards = blue + yellow


def shuffle():
    global cards
    yellow = cards[:N]
    blue = cards[N:]
    temp = [[y, b] for y, b in zip(yellow, blue)]
    cards = list(flatten(temp))


cards = []
N = 0
def main(args):
    global N
    global cards
    n = int(eval(input()))
    N = n
    m = int(eval(input()))

    cards = [x for x in range(1, (2*n)+1)]
    for _ in range(m):
        op = int(eval(input()))
        if op == 0:
            shuffle()
        else:
            cut(op)

    print(('\n'.join(map(str, cards))))


if __name__ == '__main__':
    main(sys.argv[1:])
    

# Optimized solution
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0513
AC
"""
import sys
from sys import stdin
from itertools import chain
input = stdin.readline


def flatten(listOfLists):
    "Flatten one level of nesting"
    return chain.from_iterable(listOfLists)


def cut(k):
    # ????????¨l
    global cards
    yellow = cards[:k]
    blue = cards[k:]
    cards = blue + yellow


def shuffle():
    # ????????¨l
    global cards
    yellow = cards[:N]
    blue = cards[N:]
    temp = [[y, b] for y, b in zip(yellow, blue)]
    cards = list(flatten(temp))


cards = []
def main(args):
    global cards
    n = int(eval(input()))
    N = n
    m = int(eval(input()))

    cards = [x for x in range(1, (2*n)+1)]
    for _ in range(m):
        op = int(eval(input()))
        if op == 0:
            # shuffle()
            temp = [[y, b] for y, b in zip(cards[:n], cards[n:])]
            cards = list(flatten(temp))
        else:
            # cut(k)
            cards = cards[op:] + cards[:op]

    print(('\n'.join(map(str, cards))))


if __name__ == '__main__':
    main(sys.argv[1:])
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
15 6
1 2 7 8 12 50

output:
2
"""

import sys


def solve():
    rec[0] = 0
    for i in range(c_num):
        for j in range(money - coins[i] + 1):
            rec[j + coins[i]] = min(rec[j + coins[i]], rec[j] + 1)

    return rec


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    money, c_num = list(map(int, _input[0].split()))
    coins = list(map(int, _input[1].split()))
    assert len(coins) == c_num
    rec = [float('inf')] * (money + 1)
    ans = solve()
    print((ans[-1]))

# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
15 6
1 2 7 8 12 50

output:
2
"""

import sys


def solve():
    rec[0] = 0
    for i in range(c_num):
        for j in range(coins[i], money + 1):
            rec[j] = min(rec[j], rec[j - coins[i]] + 1)

    return rec


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    money, c_num = list(map(int, _input[0].split()))
    coins = list(map(int, _input[1].split()))
    # assert len(coins) == c_num
    rec = [float('inf')] * (money + 1)
    ans = solve()
    print((ans.pop()))
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
15 6
1 2 7 8 12 50

output:
2
"""

import sys


def solve():
    rec[0] = 0
    for i in range(all_coins):
        for j in range(coins[i], money + 1):
            rec[j] = min(rec[j], rec[j - coins[i]] + 1)

    return rec


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    money, all_coins = list(map(int, _input[0].split()))
    coins = list(map(int, _input[1].split()))
    # assert len(coins) == c_num
    rec = [float('inf')] * (money + 1)
    ans = solve()
    print((ans.pop()))

# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
15 6
1 2 7 8 12 50

output:
2
"""

import sys


def solve():
    rec[0] = 0
    for coin in coins:
        for current_cost in range(coin, total_cost + 1):
            rec[current_cost] = min(rec[current_cost], rec[current_cost - coin * 1] + 1)

    return rec


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    total_cost, c_num = list(map(int, _input[0].split()))
    coins = list(map(int, _input[1].split()))
    # assert len(coins) == c_num
    rec = [float('inf')] * (total_cost + 1)
    ans = solve()
    print((ans[-1]))
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
15 6
1 2 7 8 12 50

output:
2
"""

import sys


def solve():
    rec[0] = 0
    for coin in coins:
        for current_cost in range(coin, total_cost + 1):
            rec[current_cost] = min(rec[current_cost], rec[current_cost - coin * 1] + 1)

    return rec


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    total_cost, c_num = list(map(int, _input[0].split()))
    coins = list(map(int, _input[1].split()))
    # assert len(coins) == c_num
    rec = [float('inf')] * (total_cost + 1)
    ans = solve()
    print((ans[-1]))

# Optimized solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
15 6
1 2 7 8 12 50

output:
2
"""

import sys


def solve():
    rec[0] = 0
    for coin in coins:
        for current_cost in range(coin, total_cost + 1):
            rec[current_cost] = min(rec[current_cost], rec[current_cost - coin] + 1)

    return rec


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    total_cost, c_num = list(map(int, _input[0].split()))
    coins = list(map(int, _input[1].split()))
    # assert len(coins) == c_num
    rec = [float('inf')] * (total_cost + 1)
    ans = solve()
    print((ans.pop()))
# Original solution
import itertools

def coin_change(coins, val):
    num = 1
    while True:
        for subset in itertools.combinations_with_replacement(coins, num):
            if sum(subset) == val:
                return num
        num += 1

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

c = list(map(int, input().split()))

ans = coin_change(c, n)

print(ans)

# Optimized solution
def coin_change(coins, payment):
    T = [0] + [50001] * payment
    for c in coins:
        for i in range(c, payment + 1):
            T[i] = min(T[i], T[i - c] + 1)
    return T[payment]

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

c = list(map(int, input().split()))

ans = coin_change(c, n)

print(ans)
# Original solution
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = [float("inf")]*(n+1)
dp[0] = 0
for i in range(m):
    for j in range(c[i], n+1):
        dp[j] = dp[j - c[i]]+1 if dp[j - c[i]] < dp[j] else dp[j]
print((dp[n]))

# Optimized solution
n, m = list(map(int, input().split()))
dp = [0]+[float("inf")]*n
for coin in map(int, input().split()):
    for i, j in zip(list(range(n)), list(range(coin, n+1))):
        dp[j] = min(dp[i]+1, dp[j])
print((dp[n]))
# Original solution
# -*- coding: utf-8 -*-
"""
Created on Sat May 26 12:16:54 2018
DPL-1A Rec Call Revised
@author: maezawa
"""

n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
dp = [float('inf') for _ in range(n+1)]
dp[0] = 0
#print(n,m)
#print(c)
#print(*dp, sep='\n')

for j in range(1,n+1):
    temp = []
    for i in range(m):
        if j < c[i]:
            continue
        else:
            temp.append(dp[j-c[i]]+1)
    dp[j] = min(temp)

print((dp[n]))


# Optimized solution
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
    
dp = [0] * (n+1)
for i in range(1, n+1):
    dp[i] = min([dp[i - c[j]]+1 for j in range(m) if i-c[j]>=0])

print((dp[n]))
# Original solution
from itertools import product

class DP:
    def __init__(self, value, variety, coins):
        self.value = value
        self.variety = variety
        self.coins = coins
        self.DP = [[0 for _ in range(value + 1)] for _ in range(variety)]
        self.DPinit()

    def DPinit(self):
        for row in self.DP:
            row[1] = 1
        self.DP[0] = [i for i in range(self.value + 1)]

    def DPcomp(self):
        for (m, n) in product(list(range(1, self.variety)),list(range(self.value + 1))):
                self.DP[m][n] = self.numberOfCoin(m, n)

    def numberOfCoin(self, m, n):
        if n >= self.coins[m]:
            return min(self.DP[m - 1][n], self.DP[m][n - self.coins[m]] + 1)
        else:
            return self.DP[m - 1][n]

    def answer(self):
        self.DPcomp()
        return self.DP[self.variety - 1][self.value]


if __name__ == "__main__":
    status = list(map(int,input().split()))
    coins = list(map(int,input().split()))
    dp = DP(status[0],status[1],coins)
    print((dp.answer()))

# Optimized solution
from itertools import product

value, variety = list(map(int, input().split()))
coins = list(map(int, input().split()))
dp = [float("inf") for _ in range(value + 1)]
dp[0] = 0
for (c,j) in product(coins,list(range(value + 1))):
    if c <= j:
        dp[j] = min(dp[j], dp[j - c] + 1)
    else:
        dp[j] = dp[j]
print((dp[value]))
# Original solution
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
DP = [i for i in range(n + 1)]
for cost in c:
	for i in range(cost, n + 1):
		DP[i] = min(DP[i], DP[i - cost] + 1)
print((DP[n]))



# Optimized solution
#!/usr/bin/env python
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))
DP = {}
for i in range(n + 1):
	DP[i] = n
DP[0] = 0
for cost in c:
	for i in range(cost, n + 1):
		DP[i] = min(DP[i], DP[i - cost] + 1)
print((DP[n]))
# Original solution
n,m = list(map(int,input().split()))
c = list(map(int,input().split()))

minimum = [50000] * (n+1)
minimum[0] = 0

for i in range(1,n+1):
    if minimum[i] <= 1:
        continue
    for j in range(m):
        if c[j]<=i and minimum[i-c[j]] + 1 < minimum[i]:
            minimum[i] = minimum[i-c[j]]+1

print((minimum[n]))

# Optimized solution
n = int(input().split()[0])
c = list([x for x in map(int,input().split()) if x <= n])
m = len(c)

minimum = [n] * (n+1)
minimum[0] = 0
for i in c:
    minimum[i] = 1

for i in range(1,n+1):
    for j in range(m):
        if c[j]<=i and minimum[i-c[j]] + 1 < minimum[i]:
            minimum[i] = minimum[i-c[j]]+1

print((minimum[n]))
# Original solution
n = int(input().split()[0])
c = list([x for x in map(int,input().split()) if x <= n])
m = len(c)

minimum = [n] * (n+1)
minimum[0] = 0
for i in c:
    minimum[i] = 1

for i in range(1,n+1):
    for j in range(m):
        if c[j]<=i and minimum[i-c[j]] + 1 < minimum[i]:
            minimum[i] = minimum[i-c[j]]+1

print((minimum[n]))

# Optimized solution
n = int(input().split()[0])
c = list([x for x in map(int,input().split()) if x <= n])
m = len(c)

minimum = [ i for i in range(n+1) ]
for i in c:
    minimum[i] = 1

for i in range(1,n+1):
    for j in range(m):
        if c[j]<=i and minimum[i-c[j]] + 1 < minimum[i]:
            minimum[i] = minimum[i-c[j]]+1

print((minimum[n]))
# Original solution
n = int(input().split()[0])
c = list([x for x in map(int,input().split()) if x <= n])
m = len(c)

minimum = [ i for i in range(n+1) ]
for i in c:
    minimum[i] = 1

for i in range(1,n+1):
    if minimum[i] <= 2:
        continue
    for j in range(m):
        if c[j]<=i and minimum[i-c[j]] + 1 < minimum[i]:
            minimum[i] = minimum[i-c[j]]+1

print((minimum[n]))

# Optimized solution
n = int(input().split()[0])
c = list([x for x in map(int,input().split()) if x <= n])

minimum = [ i for i in range(n+1) ]
for i in c:
    minimum[i] = 1

for i in range(2,n+1):
    for j in c:
        if j<=i and minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1

print((minimum[n]))
# Original solution
n = int(input().split()[0])
c = list([x for x in map(int,input().split()) if x <= n])

minimum = [ i for i in range(n+1) ]

for i in range(2,n+1):
    for j in c:
        if j <= i and minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1

print((minimum[n]))

# Optimized solution
n = int(input().split()[0])
c = list(map(int,input().split()))
minimum = [ i for i in range(n+1) ]

for i in range(2,n+1):
    for j in c:
        if j <= i and minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1

print((minimum[n]))
# Original solution
n,m = list(map(int, input().split()))
l = list(map(int, input().split()))
d = [0] * (n+1)

for i in range(1,n+1):
    if i in l:
        d[i] = 1
    else:
        min = 50000
        for j in range(i+1):
            if d[i-j]+d[j] < min and d[i-j]+d[j]>0:
                min = d[i-j] + d[j]
        d[i] = min

print((d[n]))

# Optimized solution
n = int(input().split()[0])
c = list(map(int,input().split()))
dp = [ i for i in range(n+1) ]

for i in range(2,n+1):
    c2 = [n for n in c if n<=i]
    for j in c2:
        if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j] + 1

print((dp[n]))
# Original solution
n = int(input().split()[0])
c = list(map(int,input().split()))
dp = [ i for i in range(n+1) ]

for i in range(2,n+1):
    c2 = [n for n in c if n<=i]
    for j in c2:
        if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j] + 1

print((dp[n]))

# Optimized solution
n = int(input().split()[0])
c = list(map(int,input().split()))
dp = list(range(n+1))

for i in range(2,n+1):
    for j in c:
        if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j]+1

print((dp[n]))
# Original solution
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))

INF = 10**12

T = [[INF for i in range(n+1)] for j in range(m)]

for i in range(n+1):
    T[0][i] = i

for i in range(m):
    T[i][0] = 0

for i in range(m):
    for j in range(1, n+1):
        if j - c[i] >= 0:
            T[i][j] = min(T[i-1][j], T[i][j - c[i]] + 1)
        else:
            T[i][j] = T[i-1][j]

print((T[m-1][n]))

# Optimized solution
n, m = list(map(int, input().split()))
c = list(map(int, input().split()))

INF = 10**12

T = [i for i in range(n+1)]

for i in range(m):
    for j in range(1, n+1):
        if j - c[i] >= 0:
            T[j] = min(T[j], T[j - c[i]] + 1)

print((T[n]))
# Original solution
import math
n, m = list(map(int,input().split(' ')))
d = list(map(int,input().split(' ')))
d.sort()
inf = n

dp = [ [ inf for i in range(m+1)] for j in range(n+1) ]

# dp
for j in range(m+1):
    dp[0][j]=0

for j in range(m-1,-1,-1):
    for i in range(n+1):
        for k in range(math.floor(i/d[j])+1 ):
            r = (k)*d[j]
            #print(i,j,k)
            dp[i][j] = min( dp[i][j], min( dp[i][j+1], dp[i-r][j]+k) )

print((dp[n][0]))



# Optimized solution
import math
n, m = list(map(int,input().split(' ')))
d = list(map(int,input().split(' ')))
d.sort()
inf = n

dp = [ [ inf for i in range(m+1)] for j in range(n+1) ]

# dp
for j in range(m+1):
    dp[0][j]=0

for j in range(m-1,-1,-1):
    for i in range(n+1):
        #for k in range(math.floor(i/d[j])+1):
        if math.floor(i/d[j]) >=1:
            k=1
        else:
            k=0
        r = k*d[j]
        #print(i,j,k)
        dp[i][j] = min( dp[i][j], dp[i][j+1], dp[i-r][j]+k ) 
        #print("dp:",i,j,dp[i][j])
print((dp[n][0]))
# Original solution
n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
dp = [False for i in range(n + 1)]
for i in range(m):
    if l[i] <= n: dp[l[i]] = True
cnt = 1
while 1:
    if dp[n]: break
    ndp = [False for i in range(n + 1)]
    for i in range(n+1):
        if dp[i]:
            ndp[i] = True
            for j in range(m):
                if i + l[j] <= n: ndp[i+l[j]] = True
    cnt += 1
    dp = ndp
print(cnt)

# Optimized solution
n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
INF = 1<<31
dp = [INF]*(n+1)
dp[0] = 0
for c in l:
    for i in range(n-c+1):
        if dp[i] != INF:
            dp[i + c] = min(dp[i] + 1, dp[i + c])
print(dp[n])
# Original solution
def calc_number_of_coin(sum, coins):
    dp = [999999999]*(sum+1)
    dp[0] = 0
    for i in range(len(coins)):
        for j in range(coins[i], sum+1):
            dp[j] = min(dp[j], dp[j-coins[i]]+1)
    return dp[sum]



if __name__ == '__main__':
    # ??????????????\???
    # f = open('input.txt')
    # sum, _ = [int(x) for x in f.readline().strip().split(' ')]
    # coins = [int(x) for x in f.readline().strip().split(' ')]

    sum, _ = [int(x) for x in input().strip().split(' ')]
    coins = [int(x) for x in input().strip().split(' ')]

    # ???????????????
    result = calc_number_of_coin(sum, coins)

    # ???????????¨???
    print(result)

# Optimized solution
def calc_number_of_coin(sum, coins):
    dp = [999999999]*(sum+1)    #  ??????????????????????????????????????????????????????????????????dp[sum]????????????????±????????????????????´?????????????9999???????????????????????°
    dp[0] = 0                   #  0??????????????????????????¶???????????°???0???
    
    # i??????????????????????????????????¨????, j????????????????¨???????
    # ?????????????????¨??§???????????????????¨???????1?¨?????????????????????????????????????????????°????¨??????????
    # ????????????i???????????§?????¨??§???????????????????¨????????¢??????????????????????????¶???????
    for i in range(len(coins)):
        for j in range(coins[i], sum+1):
            # dp[j]: ??????????????????????????°????¢?????????????????????°?????????????????´???
            # dp[j - coins[i]] + 1:  ??°???????????¨??§????????????????????£??????????????????????????¨??§?????????????????°???????????±?????????
            #                        ?????????+1???????????§??????????¨???????-coins[i]????????????????????????????????°????????????+1???coins[i]???
            dp[j] = min(dp[j], dp[j-coins[i]]+1)
    return dp[sum]


if __name__ == '__main__':
    # ??????????????\???
    # f = open('input.txt')
    # sum, _ = [int(x) for x in f.readline().strip().split(' ')]
    # coins = [int(x) for x in f.readline().strip().split(' ')]

    sum, _ = [int(x) for x in input().strip().split(' ')]
    coins = [int(x) for x in input().strip().split(' ')]

    # ???????????????
    result = calc_number_of_coin(sum, coins)

    # ???????????¨???
    print(result)
# Original solution
# -*- coding: utf-8 -*-
N, M = tuple(map(int, input().split()))
coins = sorted(tuple(map(int, input().split())))

counts = [float("inf") for _ in range(N+1)]
counts[0] = 0

for m in range(M):
    coin = coins[m]
    for n in range(coin, N+1):
        counts[n] = min(counts[n], counts[n-coin] + 1)

print((counts[-1]))

# Optimized solution
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
n, m = inpl()
C = sorted(inpl())
DP = list(range(n+1))

for c in C[1:]:
    for i in range(n-c+1):
        if DP[i] + 1 < DP[i+c]:
            DP[i+c] = DP[i] + 1
            
print((DP[-1]))