#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
const int mod = 1000000007;
struct ins {
  int type;
  int val;
  ins() {}
  ins(int a, int b) {
    type = a;
    val = b;
  }
};
vector<ins> given;
vector<ins> totalans;
multiset<int> forsim;
multiset<int>::iterator it;
int main() {
  int n;
  scanf("%d", &n);
  int i, va;
  char str[20];
  for (i = 1; i <= n; i++) {
    scanf("%s", str);
    if (str[0] == 'i') {
      scanf("%d", &va);
      given.push_back(ins(1, va));
    } else if (str[0] == 'g') {
      scanf("%d", &va);
      given.push_back(ins(2, va));
    } else {
      given.push_back(ins(3, -1));
    }
  }
  for (i = 0; i < n; i++) {
    if (given[i].type == 1) {
      int whval = given[i].val;
      forsim.insert(whval);
      totalans.push_back(ins(given[i].type, whval));
    } else if (given[i].type == 2) {
      int whval = given[i].val;
      while (1) {
        if (forsim.empty()) break;
        it = forsim.begin();
        if (*it < whval) {
          forsim.erase(it);
          totalans.push_back(ins(3, -1));
        } else {
          break;
        }
      }
      if (forsim.empty()) {
        forsim.insert(whval);
        totalans.push_back(ins(1, whval));
      } else {
        it = forsim.begin();
        if (*it == whval) {
        } else {
          forsim.insert(whval);
          totalans.push_back(ins(1, whval));
        }
      }
      totalans.push_back(ins(2, whval));
    } else if (given[i].type == 3) {
      if (forsim.empty()) {
        totalans.push_back(ins(1, 1));
        totalans.push_back(ins(3, -1));
      } else {
        it = forsim.begin();
        forsim.erase(it);
        totalans.push_back(ins(3, -1));
      }
    }
  }
  int totalanssz = totalans.size();
  printf("%d\n", totalanssz);
  for (i = 0; i < totalanssz; i++) {
    if (totalans[i].type == 1) {
      printf("insert %d\n", totalans[i].val);
    } else if (totalans[i].type == 2) {
      printf("getMin %d\n", totalans[i].val);
    } else if (totalans[i].type == 3) {
      printf("removeMin\n");
    }
  }
  return 0;
}
