#include <bits/stdc++.h>
using namespace std;
const int limit = 1e9 + 10;
const int N = 1e6 + 10;
priority_queue<int, vector<int>, greater<int> > q;
char ans[N][11];
int a[N];
int main() {
  int n, x, cnt = 0;
  char s[11];
  scanf("%d", &n);
  while (n--) {
    scanf("%s", s);
    if (s[0] == 'r') {
      if (q.empty()) {
        strcpy(ans[cnt], "insert");
        a[cnt++] = 1;
        q.push(1);
      }
      strcpy(ans[cnt], s);
      a[cnt++] = limit;
      q.pop();
    } else {
      scanf("%d", &x);
      if (s[0] == 'i') {
        q.push(x);
        strcpy(ans[cnt], s);
        a[cnt++] = x;
      } else if (s[0] == 'g') {
        int flag = 0;
        while (!q.empty()) {
          if (q.top() >= x) {
            flag = 1;
            break;
          }
          q.pop();
          strcpy(ans[cnt], "removeMin");
          a[cnt++] = limit;
        }
        if (!flag || q.top() > x) {
          strcpy(ans[cnt], "insert");
          a[cnt++] = x;
          q.push(x);
        }
        strcpy(ans[cnt], s);
        a[cnt++] = x;
      }
    }
  }
  printf("%d\n", cnt);
  for (int i = 0; i < cnt; i++) {
    printf("%s", ans[i]);
    if (a[i] != limit)
      printf(" %d\n", a[i]);
    else
      printf("\n");
  }
  return 0;
}
