#include using namespace std; using ll = long long; const int MOD = 1e9+7; int main() { int N; string S; cin >> N; cin >> S; int ans = 0; ans += count(S.begin(), S.end(), '7'); ans += count(S.begin(), S.end(), '3'); ans += count(S.begin(), S.end(), '5'); int one = 0; int u = 0; for(int i = 0;i < N;i++){ if(S[i] == '1'){ one++; } if(S[i] == '9' && one != 0){ u++; one--; } } ans += u; ans += (count(S.begin(), S.end(), '1') - u)/2; cout<