#include <bits/stdc++.h>
using namespace std;
multiset<int> s1;
struct node {
  char s;
  int a1;
} p1[int(1e6 + 50)];
char s[50];
int main() {
  int n, a;
  while (~scanf("%d", &n)) {
    int cnt = 0;
    s1.clear();
    for (int i = 0; i < n; i++) {
      scanf("%s", s);
      if (s[0] != 'r') {
        scanf("%d", &a);
        if (s[0] == 'i') {
          s1.insert(a);
          p1[cnt].s = 'i';
          p1[cnt++].a1 = a;
        } else if (s[0] == 'g') {
          while (!s1.empty() && (*s1.begin()) < a) {
            s1.erase(s1.begin());
            p1[cnt++].s = 'r';
          }
          if (s1.empty() || (!s1.empty() && (*s1.begin()) > a)) {
            s1.insert(a);
            p1[cnt].s = 'i';
            p1[cnt++].a1 = a;
          }
          p1[cnt].s = 'g';
          p1[cnt++].a1 = a;
        }
      } else {
        if (!s1.empty()) {
          s1.erase(s1.begin());
        } else {
          p1[cnt].s = 'i';
          p1[cnt++].a1 = 0;
        }
        p1[cnt++].s = 'r';
      }
    }
    printf("%d\n", cnt);
    for (int i = 0; i < cnt; i++) {
      if (p1[i].s == 'i') {
        printf("insert %d\n", p1[i].a1);
      } else if (p1[i].s == 'g') {
        printf("getMin %d\n", p1[i].a1);
      } else if (p1[i].s == 'r') {
        printf("removeMin\n");
      }
    }
    puts("");
  }
}
