#include using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string S; cin >> S; // 11, 19 を何個とることができるかを考える。 int counter = 0; int ans = 0; for (char s : S){ int x = s - '0'; if (x == 1){ ++counter; }else if (x == 9){ if (counter > 0){ --counter; ++ans; } }else{ ++ans; } } cout << ans + counter / 2 << endl; return 0; }