#include using namespace std; #define rep(i,n) for(ll i=0;i<(n);++i) #define reps(i,n) for(ll i=1;i<=(n);++i) using ll = long long; using str = string; constexpr long long INF = (1LL<<60); constexpr long long MOD = (1e9+7); templateinline bool chmax(T &a,const T &b){if(ainline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} inline void dump(){cout<inline void dump(Head&& head, Tail&&... tail){cout<(tail)...);} templateinline istream &operator>>(istream&input,vector&v){for(auto &elemnt:v)input>>elemnt;return input;} templatevector make_vector(size_t a){return vector(a);} templateauto make_vector(size_t a, Ts... ts){return vector(ts...))>(a, make_vector(ts...));} main(){ cin.tie(0); ios::sync_with_stdio(0); cout<>n>>s; ll one,three,five,seven,nine,ans; one=three=five=seven=nine=ans=0; rep(i,n){ if(s[i]=='1')one++; if(s[i]=='3'){ three++; if(one){ one--; three--; ans++; } } if(s[i]=='5')five++; if(s[i]=='7'){ seven++; if(nine){ nine--; seven--; ans++; } else if(one){ one--; seven--; ans++; } } if(s[i]=='9'){ nine++; if(one){ one--; nine--; ans++; } else if(five){ five--; nine--; ans++; } else if(seven){ seven--; nine--; ans++; } } } ans += three; ans += five; ans += seven; ans += one/2; cout<<(ans)<