#include using namespace std; int main(){ int n; string s; cin >> n >> s; assert(1 <= n && n <= 500000); int one = 0, nine = 0, ans = 0; for(int i = 0; i < n; i++){ assert(s[i] == '1' || s[i] == '3' || s[i] == '5' || s[i] == '7' || s[i] == '9'); if(s[i] == '3' || s[i] == '5' || s[i] == '7') ans++; else if(s[i] == '1'){ if(nine >= 2) nine -= 2, ans++; else one++; }else{ if(one >= 1) one--, ans++; else nine++; } } ans += one / 2; cout << ans << endl; }