#include <bits/stdc++.h>
using namespace std;
char command[100004];
int num[100004];
char result_command[1000004];
int result_num[1000004];
int main() {
  int n;
  scanf("%d ", &n);
  for (int i = 0; i < n; i++) {
    char buf[16];
    scanf("%s", buf);
    command[i] = buf[0];
    if (command[i] != 'r') scanf("%d ", &num[i]);
  }
  int pnt = 0;
  priority_queue<int> Q;
  for (int i = 0; i < n; i++) {
    if (command[i] == 'i') {
      result_command[pnt] = 'i';
      result_num[pnt] = num[i];
      Q.push(-num[i]);
      pnt++;
    } else if (command[i] == 'r') {
      if (Q.size() == 0) {
        result_command[pnt] = 'i';
        result_num[pnt] = 1;
        Q.push(-1);
        pnt++;
      }
      result_command[pnt++] = 'r';
      Q.pop();
    } else {
      int now_v = num[i];
      while (!Q.empty()) {
        int v = -Q.top();
        if (v < now_v) {
          result_command[pnt++] = 'r';
          Q.pop();
        } else
          break;
      }
      if ((!Q.empty()) && (-Q.top()) == now_v) {
      } else {
        result_command[pnt] = 'i';
        result_num[pnt] = now_v;
        Q.push(-now_v);
        pnt++;
      }
      result_command[pnt] = 'g';
      result_num[pnt++] = now_v;
    }
  }
  printf("%d\n", pnt);
  for (int i = 0; i < pnt; i++) {
    char ch = result_command[i];
    if (ch == 'i') {
      printf("insert");
      printf(" %d\n", result_num[i]);
    } else if (ch == 'g') {
      printf("getMin");
      printf(" %d\n", result_num[i]);
    } else {
      printf(
          "removeMin"
          "\n");
    }
  }
  return 0;
}
