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