#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> oo;
  vector<int> pp;
  priority_queue<int, vector<int>, greater<int> > hh;
  int n, i, x;
  scanf("%d", &n);
  char s[100010];
  int cnt = 0;
  for (i = 0; i < n; i++) {
    scanf("%s", s);
    if (strcmp(s, "insert") == 0) {
      scanf("%d", &x);
      hh.push(x);
      oo.push_back("insert");
      pp.push_back(x);
      cnt++;
    } else if (strcmp(s, "getMin") == 0) {
      scanf("%d", &x);
      if (hh.empty()) {
        hh.push(x);
        oo.push_back("insert");
        pp.push_back(x);
        cnt++;
        oo.push_back("getMin");
        pp.push_back(x);
        cnt++;
        continue;
      }
      int rr = hh.top();
      if (rr == x) {
        oo.push_back("getMin");
        pp.push_back(x);
        cnt++;
      } else {
        if (rr > x) {
          hh.push(x);
          oo.push_back("insert");
          pp.push_back(x);
          cnt++;
          oo.push_back("getMin");
          pp.push_back(x);
          cnt++;
        } else {
          while (!hh.empty() && rr < x) {
            hh.pop();
            oo.push_back("removeMin");
            cnt++;
            rr = hh.top();
          }
          if (hh.empty()) {
            hh.push(x);
            oo.push_back("insert");
            pp.push_back(x);
            cnt++;
            oo.push_back("getMin");
            pp.push_back(x);
            cnt++;
            continue;
          }
          if (rr == x) {
            oo.push_back("getMin");
            pp.push_back(x);
            cnt++;
          } else {
            hh.push(x);
            oo.push_back("insert");
            pp.push_back(x);
            cnt++;
            oo.push_back("getMin");
            pp.push_back(x);
            cnt++;
          }
        }
      }
    } else {
      if (hh.empty()) {
        oo.push_back("insert");
        pp.push_back(x);
        cnt++;
        oo.push_back("removeMin");
        cnt++;
      } else {
        hh.pop();
        oo.push_back("removeMin");
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  int jj = 0;
  for (i = 0; i < oo.size(); i++) {
    cout << oo[i];
    if (oo[i] == "insert" || oo[i] == "getMin") {
      printf(" %d", pp[jj]);
      jj++;
    }
    printf("\n");
  }
}
