#include <bits/stdc++.h>
using namespace std;
int main() {
  priority_queue<int, vector<int>, greater<int> > q;
  int n;
  scanf("%d", &n);
  vector<char> res;
  vector<int> val;
  for (int i = 0; i < n; i++) {
    char command[20];
    int k;
    scanf("%s", command);
    if (strncmp(command, "removeMin", 20) == 0) {
      if (q.size() == 0) {
        res.push_back('i');
        val.push_back(0);
        q.push(0);
      }
      q.pop();
      res.push_back('r');
      val.push_back(-1);
    } else {
      scanf("%d", &k);
      if (strncmp(command, "insert", 20) == 0) {
        q.push(k);
        res.push_back('i');
        val.push_back(k);
      } else {
        while (q.size() && q.top() < k) {
          q.pop();
          res.push_back('r');
          val.push_back(-1);
        }
        if (!q.size() || q.top() > k) {
          res.push_back('i');
          val.push_back(k);
          q.push(k);
        }
        res.push_back('g');
        val.push_back(k);
      }
    }
  }
  printf("%lu\n", res.size());
  for (int i = 0, len = res.size(); i < len; i++) {
    if (res[i] == 'r') {
      printf("removeMin\n");
    } else {
      if (res[i] == 'i') {
        printf("insert %d\n", val[i]);
      } else {
        printf("getMin %d\n", val[i]);
      }
    }
  }
  return 0;
}
