#include using namespace std; int main(){ int n; string s; cin >> n >> s; assert(1 <= n && n <= 200000); 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'){ one++; }else{ if(one >= 1) one--, ans++; else nine++; } } int tmp = min(nine / 2, one); ans += tmp + (one - tmp) / 2; cout << ans << endl; }