func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 55;   int a[MAXN];   int nxt[6];   long long solve() {     int n;     scanf( %d , &n);     vector<int> ids[6];     for (int i = 0; i < n; i++) {       int x;       scanf( %d , &x);       if (x == 4) ids[0].push_back(i);       if (x == 8) ids[1].push_back(i);       if (x == 15) ids[2].push_back(i);       if (x == 16) ids[3].push_back(i);       if (x == 23) ids[4].push_back(i);       if (x == 42) ids[5].push_back(i);     }     for (int i = 0; i < 6; i++) nxt[i] = 0;     int res = 0;     for (int i : ids[0]) {       int lst = i;       nxt[0]++;       for (int j = 1; j < 6; j++) {         while (nxt[j] < ids[j].size() && ids[j][nxt[j]] < lst) {           nxt[j]++;           res++;         }         if (nxt[j] == ids[j].size()) {           for (int k = 0; k < 6; k++) {             res += ids[k].size() - nxt[k];           }           res += j;           return res;         }         lst = ids[j][nxt[j]];         nxt[j]++;       }     }     int len = ids[0].size();     return (n - res) - len * 6;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int T;     T = 1;     while (T--) {       printf( %lld n , solve());     }     return 0;   }   