#include<iostream> #include<string.h> using namespace std; int main() { char n[10]; while(cin >> n){ int sum = 0; for(int i = 0; i < strlen(n); i++){ if(n[i] == '0' || n[i] == '6' || n[i] == '9') sum++; else if(n[i] == '8') sum += 2; } cout << sum << endl; } return 0; }