#include <bits/stdc++.h>
using namespace std;
bool flag[4000000];
int n, cnt, res2[4000000];
char ins[15], res1[4000000][15];
priority_queue<int, vector<int>, greater<int> > que;
void print() {
  printf("%d\n", cnt);
  for (int i = 0; i < cnt; i++) {
    if (res1[i][0] == 'r')
      puts(res1[i]);
    else
      printf("%s %d\n", res1[i], res2[i]);
  }
}
int main() {
  scanf("%d", &n);
  while (n--) {
    scanf("%s", ins);
    if (ins[0] == 'i') {
      int temp;
      scanf("%d", &temp);
      que.push(temp);
      strcpy(res1[cnt], ins);
      res2[cnt] = temp;
      cnt++;
    } else if (ins[0] == 'r') {
      if (que.empty()) {
        strcpy(res1[cnt], "insert");
        res2[cnt] = 1;
        cnt++;
        que.push(1);
      }
      que.pop();
      strcpy(res1[cnt], ins);
      flag[cnt] = true;
      cnt++;
    } else if (ins[0] == 'g') {
      int tmin;
      scanf("%d", &tmin);
      while (true) {
        if (que.empty()) {
          strcpy(res1[cnt], "insert");
          res2[cnt] = tmin;
          cnt++;
          que.push(tmin);
          strcpy(res1[cnt], ins);
          res2[cnt] = tmin;
          cnt++;
          break;
        }
        int temp = que.top();
        if (temp < tmin) {
          que.pop();
          strcpy(res1[cnt], "removeMin");
          flag[cnt] = true;
          cnt++;
          if (que.empty()) {
            strcpy(res1[cnt], "insert");
            res2[cnt] = tmin;
            cnt++;
            que.push(tmin);
            strcpy(res1[cnt], ins);
            res2[cnt] = tmin;
            cnt++;
            break;
          }
        } else if (temp == tmin) {
          strcpy(res1[cnt], ins);
          res2[cnt] = tmin;
          cnt++;
          break;
        } else if (temp > tmin) {
          strcpy(res1[cnt], "insert");
          res2[cnt] = tmin;
          cnt++;
          que.push(tmin);
          strcpy(res1[cnt], ins);
          res2[cnt] = tmin;
          cnt++;
          break;
        }
      }
    }
  }
  print();
  return 0;
}
