#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rep(i, n) repr(i, 0, n) #define INF 2e9 #define MOD 1000000007 //#define MOD 998244353 #define LINF (long long)4e18 #define jck 3.141592 using ll = long long; using Pi = pair; using Pl = pair; int main(){ int N; cin >> N; string S; cin >> S; int ans = 0; int now1 = 0; int now9 = 0; rep(i,N){ if(S[i] == '3' || S[i] == '5' || S[i] == '7') ans++; if(S[i] == '1'){ now1++; if(now9 >= 2){ now1--; now9 -= 2; ans++; } else if(now1 >= 2){ now1 -= 2; ans++; } } if(S[i] == '9'){ now9++; if(now1 > 0){ now1--; now9--; ans++; } } } cout << ans << endl; }