#include <iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

int main()
{int n,k,l=0;
scanf("%d",&n);
while(n>=0)
{k=n%10;
switch(k)
{case 1:case 2:case 5: l=l+1;break;
case 3:case 4:case 6:case 7:l=l+2;break;
case 8:case 9:l=l+3;break;
case 0: l=l;break;
}
n=n/10;
}
printf("%d",l);
    return 0;
}