n = gets.to_i

sum = 0

if n % 2 == 0 then
	len = n.to_s().size
#	print 10 ** len
#	puts
	
	(len - 1).downto(1){ |i|
		div = n / (10 ** i)
		sum += div
#		n = n - div * (10 ** i)
	}

	(1..1000000).each{ |i|
		base = (5 ** i) * 10
		
#		puts (n / base) * (2 ** i - 1) / (2 ** i)
		
		if n >= base then
			sum += (n / base) * (2 ** i - 1) / (2 ** i)
		else
			puts i
			break
		end
	}

	puts sum
else
	puts 0
end
