func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, b;     while (cin >> n) {       stack<int> st;       bool ov = true;       int ovs = 0;       int res = 0;       int spd = 0;       for (int i = 0; i < n; i++) {         scanf( %d , &(a));         if (a == 1) {           scanf( %d , &(b));           spd = b;         } else if (a == 2) {           res += ovs;           ovs = 0;         } else if (a == 3) {           scanf( %d , &(b));           st.push(b);         } else if (a == 4) {           ovs = 0;         } else if (a == 5) {           while (!st.empty()) st.pop();         } else if (a == 6) {           ovs++;         }         while (!st.empty() && st.top() < spd) {           st.pop();           res++;         }       }       cout << res << endl;     }     return 0;   }   