#include <iostream>
#include <string>
using namespace std;

int nadji(int k) {
	if (k == '0') return 0;
	else if (k == '5' || k == '1' || k == '2') return 1;
	else if (k == '3' || k == '4' || k == '6' || k == '7') return 2;
	else return 3;
}


int main()
{
	string v;
	cin >> v;

	int brojac = 0;

	for (int i = 0; i < size(v); ++i)
		brojac += nadji(v[i]);

	cout << brojac;

}