#include #include int main() { int a[9] = {0}; int n; char c; scanf("%d\n",&n); for(int i=0;i=2)) { int dd=std::min({a[7],a[5],a[3],a[1]/2}); happy+=dd; a[7]-=dd; a[5]-=dd; a[3]-=dd; a[1]-=(2*dd); } if (a[7] && a[5] && (a[3]>=2)) { int dd=std::min({a[7],a[5],a[3]/2}); happy+=dd; a[7]-=dd; a[5]-=dd; a[3]-=(2*dd); } if (a[7] && (a[5]>=2)) { int dd=std::min({a[7],a[5]/2}); happy+=dd; a[7]-=dd; a[5]-=(2*dd); } printf ("%d\n",happy); }