#include "bits/stdc++.h" using namespace std; #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) #define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--) #define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end()) #define MOD 1000000007 #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL typedef long long ll; int main() { string s; cin >> s; int cnt[3] = {}; REP(i,s.size()) { char t = s[i] - '0'; if(t==1||t==2||t==3||t==5||t==7) cnt[0]++; if(t==0||t==4||t==6||t==9) cnt[1]++; if(t==8) cnt[2]++; } if(cnt[0] > 0 && cnt[1] == 0 && cnt[2] == 0) { cout << cnt[0] + 2 << endl; return 0; } if(cnt[0] == 0 && (cnt[1] > 0 || cnt[2] > 0)) { cout << cnt[1] * 3 + cnt[2] * 4 + 1 << endl; return 0; } cout << cnt[0] * 2 + cnt[1] * 3 + cnt[2] * 4 + 1 << endl; return 0; }