#include using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define fi first #define se second typedef vectorvint; typedef pairpint; typedef vectorvpint; templateinline void chmin(A &a,B b){if(a>b)a=b;} templateinline void chmax(A &a,B b){if(a ostream& operator<<(ostream& ost,const pair&p){ ost<<"{"< ostream& operator<<(ostream& ost,const vector&v){ ost<<"{"; for(int i=0;i>N>>S; int ans=0; vint v; int z=0; int n=0; rep(i,N){ if(S[i]=='1'){ if(n>=2){ n-=2; ans++; } else z++; } else if(S[i]=='9'){ if(z){ z--; ans++; } else n++; } else ans++; } ans+=z/2; cout<