#include <bits/stdc++.h>
using namespace std;
struct pii {
  char e;
  int x;
  pii(char e, int x) {
    this->e = e;
    this->x = x;
  }
  pii(){};
};
int n, x;
char c, d;
string s;
priority_queue<int, vector<int>, greater<int> > hd;
vector<pii> b;
int main() {
  scanf("%d", &n);
  scanf("\n");
  for (int i = 1; i <= n; i++) {
    cin >> s;
    c = s[0];
    if (s[0] != 'r') scanf("%d", &x);
    if (c == 'i') {
      b.push_back(pii(c, x));
      hd.push(x);
      continue;
    }
    if ((c == 'r') && (!hd.size())) {
      b.push_back(pii('i', 0));
      b.push_back(pii('r', 0));
      continue;
    }
    if (c == 'r') {
      b.push_back(pii(c, 0));
      hd.pop();
      continue;
    }
    while ((hd.size()) && (hd.top() < x)) {
      hd.pop();
      b.push_back(pii('r', 0));
    }
    if (!(hd.size()) || (hd.top() > x)) {
      b.push_back(pii('i', x));
      hd.push(x);
    }
    b.push_back(pii('g', hd.top()));
  }
  printf("%d\n", b.size());
  for (int i = 0; i < b.size(); i++)
    if (b[i].e == 'r')
      printf("removeMin\n");
    else if (b[i].e == 'i')
      printf("insert %d\n", b[i].x);
    else
      printf("getMin %d\n", b[i].x);
  return 0;
}
