#include using namespace std; string z; int main(){ int n; string s;cin>>n>>s; int ans = 0; for(int i = 0; n > i; i++){ if(s[i] == '3' || s[i] == '5' || s[i] == '7')ans++; else z.push_back(s[i]); } int tmp = 0; for(int i = z.size()-1;0 <= i; i--){ if(z[i] == '1'){ if(tmp){ ans++; tmp--; }else{ tmp++; } }else{ tmp++; } } cout << ans << endl; }