#include int ri() { int n; scanf("%d", &n); return n; } int main() { int n = ri(); std::string s; std::cin >> s; int res = 0; std::string s_; for (int i = 0; i < n; i++) { if (s[i] == '3' || s[i] == '5' || s[i] == '7') res++; else s_.push_back(s[i]); } std::swap(s, s_); std::vector pos9, pos1; for (int i = (int) s.size() - 1; i >= 0; i--) { if (s[i] == '9') pos9.push_back(i); else { if (pos9.size()) s[pos9.back()] = '0', pos9.pop_back(), res++; else pos1.push_back(i); } } for (int i = (int) pos9.size() - 2; i >= 0; i--) { int pos = pos9[i + 1]; if (pos1.size() && pos1.back() > pos) pos1.pop_back(), i--, res++; } res += pos1.size() / 2; std::cout << res << std::endl; return 0; }