import java.io.{BufferedReader, InputStreamReader}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine.toLong

    System.out.println(
      if (n % 2L == 1) {
        0
      } else {
        BigInt(n / 2L).toString(5).reverse.map(_.toInt - '0').foldLeft((0L, 0L)) {
          case ((acc, base), i) =>
            (acc + base * i, base * 5L + 1L)
        }._1
      }
    )
  }
}
