#include <iostream>

using namespace std;

int main()
{
	string num;
	cin >> num;
	int length = num.size();
	int summ = 0;

	for (int i = 0; i < length; i++)
	{
		switch (num[i])
		{
		case '1':
			summ += 1;
				break;
		case '2':
			summ += 1;
			break;
		case '3':
			summ += 2;
			break;
		case '4':
			summ += 2;
			break;
		case '5':
			summ += 1;
			break;
		case '6':
			summ += 2;
			break;
		case '7':
			summ += 2;
			break;
		case '8':
			summ += 3;
			break;
		case '9':
			summ += 3;
			break;
		default:
			break;
		}
	}
	cout << summ;
	return 0;
}