#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "<>n; string s; //string tmp; queue q; int ans = 0; REP(i,n){ char c; cin>>c; if(c=='3'||c=='5'||c=='7'){ ans++; continue; } s += c; } if(s==""){ cout << ans << endl; return 0; } string ss=""; bool found19=false; do{ found19=false; ss=s[0]; FOR(i,1,s.size()){ ss += s[i]; if(ss[ss.size()-2]=='1' && ss[ss.size()-1]=='9'){ found19=true; ss = ss.substr(0,ss.size()-2); ans++; } } s=ss; }while(found19); int cnt1=0; int cnt9=0; REP(i,s.size()){ if(s[i]=='1') cnt1++; if(s[i]=='9') cnt9++; } //DEBUG2(cnt1,cnt9); string tmp =""; FORR(i,1,s.size()){ if(s[i]!='1') continue; tmp =""; FORR(j,0,i){ if(s[j]=='9'){ if(tmp.size()==2){ ans+=1; cnt1-=1; cnt9-=2; tmp=""; break; } else tmp+="9"; } } if(cnt9<2) break; } //DEBUG2(cnt1,cnt9); ans += cnt1/2; cout << ans << endl; return 0; }