#include <bits/stdc++.h>
using namespace std;
struct cmp {
  bool operator()(long long a, long long b) { return (a > b); }
};
int main() {
  vector<string> jeff;
  stringstream me;
  long long cnt = 0;
  long long n;
  cin >> n;
  string str;
  long long f;
  priority_queue<long long, vector<long long>, cmp> pq;
  for (long long i = 0; i < n; i++) {
    cin >> str;
    if (str[0] == 'i') {
      cin >> f;
      cnt += 1;
      me << str + " " << f << "\n";
      pq.push(f);
    } else if (str[0] == 'r') {
      if (pq.empty()) {
        cnt += 1;
        me << "insert 0\n";
        pq.push(0);
      }
      cnt += 1;
      me << str + "\n";
      pq.pop();
    } else if (str[0] == 'g') {
      cin >> f;
      if (pq.empty()) {
        cnt += 1;
        me << "insert " << f << "\n";
        pq.push(f);
      } else if (f < pq.top()) {
        cnt += 1;
        me << "insert " << f << "\n";
        pq.push(f);
      } else if (f > pq.top()) {
        while (f > pq.top() && !(pq.empty())) {
          cnt += 1;
          me << "removeMin\n";
          pq.pop();
        }
        if (pq.empty() || pq.top() > f) {
          cnt += 1;
          me << "insert " << f << "\n";
          pq.push(f);
        }
      }
      cnt += 1;
      me << str + " " << f << "\n";
    }
  }
  cout << cnt << '\n';
  cout << me.str();
  return 0;
}
