#include using namespace std; #define fs first #define sc second #define pb push_back #define mp make_pair #define eb emplace_back #define ALL(A) A.begin(),A.end() #define RALL(A) A.rbegin(),A.rend() typedef long long LL; typedef pair P; LL mod=1000000007; LL LINF=1LL<<60; const int INF=1<<30; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; int main(){ int n;cin >> n; string s; cin >> s; int ans = 0; int a=0,b=0; for (int i = 0; i < n; i++) { if(s[i]=='3'||s[i]=='5'||s[i]=='7'){ ans++; } else if(s[i]=='9'){ if(b){ ans++; b--; } else a++; } else if(s[i]=='1'){ if(a>=2){ a-=2; ans++; } else b++; } } cout << ans << endl; return 0; }