#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=1444999999999999; ll mod=998244353; int main(){ ll n; cin >> n; string s; cin >> s; ll ans=0; ll x=0,y=0; for (ll i = 0; i < s.size(); i++) { if (s[i]=='3'||s[i]=='5'||s[i]=='7') { ans+=1; }else if (s[i]=='1') { x+=1; }else{ if (x>0) { ans+=1; x-=1; }else{ y+=1; } } } ans+=min(y/2,x); x-=min(y/2,x); ans+=x/2; cout << ans << endl; }