#include <iostream>
using namespace std;

int main()
{
unsigned long long Broj;
unsigned long long n;
int brn = 0;
cin >> Broj;

while (Broj != 0) 
{
n = Broj%10;

switch (n)
{
case 0: break;
case 1:
case 2:
case 5: brn = brn + 1; break;
case 3:
case 4:
case 6:
case 7: brn = brn + 2; break;
case 8:
case 9: brn = brn + 3; break;

}
Broj = Broj/10;
}

std::cout << brn << std::endl;
return 0;
}