#include <bits/stdc++.h>
using namespace std;
struct node {
  char s[20];
  int num;
} a[1000010];
int main() {
  int m, n, i, num, w;
  char str[20];
  while (~scanf("%d", &n)) {
    w = 0;
    priority_queue<int, vector<int>, greater<int> > q;
    for (i = 1; i <= n; i++) {
      scanf(" %s", str);
      if (str[0] != 'r') scanf("%d", &num);
      if (str[0] == 'i') {
        q.push(num);
      }
      if (str[0] == 'r') {
        if (q.empty()) {
          a[w].num = 0;
          strcpy(a[w++].s, "insert");
          q.push(0);
        }
        q.pop();
      }
      if (str[0] == 'g') {
        while (!q.empty() && q.top() < num) {
          strcpy(a[w++].s, "removeMin");
          q.pop();
        }
        while (q.empty() || q.top() > num) {
          strcpy(a[w].s, "insert");
          a[w++].num = num;
          q.push(num);
        }
      }
      strcpy(a[w++].s, str);
      if (str[0] != 'r') a[w - 1].num = num;
    }
    printf("%d\n", w);
    for (i = 0; i < w; i++) {
      printf("%s", a[i].s);
      if (a[i].s[0] != 'r') printf(" %d", a[i].num);
      printf("\n");
    }
  }
  return 0;
}
