#include <stdio.h>

int main() {
  unsigned long long int v;
  unsigned short int n, t;
  scanf ("%llu", &v);

  while (v / 10 > 0) {
    t = v % 10;
    n += t / 5;
    t %= 5;
    n += t / 2;
    t %= 2;
    n += t;
    v /= 10;
  }

  printf("%llu", n);
  return 0;
}