#include <bits/stdc++.h>
int SIZE = 0;
int heap[1000000];
int n;
struct LOG {
  int c;
  int x;
};
int cnt = 0;
struct LOG lg[1000001];
int heap_remove() {
  int min, lc, rc, temp, p, rem;
  rem = heap[1];
  heap[1] = heap[SIZE];
  SIZE--;
  if (SIZE > 0) {
    p = 1;
    while (2 * p <= SIZE) {
      lc = 2 * p;
      rc = 2 * p + 1;
      min = lc;
      if (rc <= SIZE && heap[rc] < heap[min]) min = rc;
      if (heap[min] < heap[p]) {
        temp = heap[p];
        heap[p] = heap[min];
        heap[min] = temp;
      } else
        break;
      p = min;
    }
  }
  return rem;
}
void heap_add(int x) {
  SIZE++;
  heap[SIZE] = x;
  int p = SIZE;
  while (p > 1 && heap[p] < heap[p / 2]) {
    int t = heap[p];
    heap[p] = heap[p / 2];
    heap[p / 2] = t;
    p /= 2;
  }
}
void logg(char c, int x) {
  lg[cnt].c = c;
  lg[cnt].x = x;
  cnt++;
}
int main3() {
  int i;
  heap_add(9);
  heap_add(8);
  heap_add(7);
  heap_add(4);
  heap_add(19);
  heap_add(21);
  heap_add(12);
  heap_add(3);
  heap_add(1);
  for (i = 1; i < SIZE; i++) printf("%d ", heap[i]);
  printf("\n");
  while (SIZE > 0) {
    printf("%d ", heap[1]);
    heap_remove();
  }
}
int main() {
  int i, x, f, c;
  char cmd[80];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s", cmd);
    if (!strcmp(cmd, "insert")) {
      scanf("%d", &x);
      heap_add(x);
      logg('i', x);
    } else if (!strcmp(cmd, "removeMin")) {
      if (SIZE == 0) {
        heap_add(0);
        logg('i', 0);
      }
      heap_remove();
      logg('r', 0);
    } else if (!strcmp(cmd, "getMin")) {
      scanf("%d", &x);
      while (SIZE > 0 && heap[1] < x) {
        logg('r', 0);
        heap_remove();
      }
      if (SIZE == 0 || (SIZE > 0 && heap[1] > x)) {
        logg('i', x);
        heap_add(x);
      }
      logg('g', x);
    }
  }
  printf("%d\n", cnt);
  i = 0;
  while (i < cnt && i <= 1000000) {
    if (lg[i].c == 'r')
      printf("removeMin\n");
    else if (lg[i].c == 'i')
      printf("insert %d\n", lg[i].x);
    else if (lg[i].c == 'g')
      printf("getMin %d\n", lg[i].x);
    i++;
  }
}
