#include <bits/stdc++.h>
using namespace std;
vector<string> a;
vector<char> c;
priority_queue<int, vector<int>, greater<int> > b;
int main() {
  int n;
  char s[30];
  scanf("%d", &n);
  getchar();
  for (int i = 0; i < n; i++) {
    int ans, tt;
    gets(s);
    if (s[0] == 'i') {
      ans = 0, tt = 1;
      for (int i = strlen(s) - 1;; i--) {
        if (isspace(s[i])) break;
        if (s[i] == '-') {
          ans = -ans;
          break;
        }
        ans += (s[i] - '0') * tt;
        tt *= 10;
      }
      b.push(ans);
      a.push_back(s);
    } else if (s[0] == 'r') {
      if (b.empty()) {
        a.push_back("insert 0");
        a.push_back("removeMin");
      } else {
        b.pop();
        a.push_back(s);
      }
    } else if (s[0] == 'g') {
      if (b.empty()) {
        string s1 = "insert ";
        int ans = 0, tt = 1;
        for (int i = strlen(s) - 1;; i--) {
          if (isspace(s[i])) break;
          if (s[i] == '-') {
            ans = -ans;
            break;
          }
          ans += (s[i] - '0') * tt;
          tt *= 10;
        }
        b.push(ans);
        for (int i = 7; i < strlen(s); i++) s1 += s[i];
        a.push_back(s1);
      } else {
        ans = 0, tt = 1;
        for (int i = strlen(s) - 1;; i--) {
          if (isspace(s[i])) break;
          if (s[i] == '-') {
            ans = -ans;
            break;
          }
          ans += (s[i] - '0') * tt;
          tt *= 10;
        }
        if (b.top() < ans)
          while (!b.empty()) {
            if (b.top() >= ans) break;
            b.pop();
            a.push_back("removeMin");
          }
        if (b.top() > ans || b.empty()) {
          string s1 = "insert ";
          b.push(ans);
          for (int i = 7; i < strlen(s); i++) s1 += s[i];
          a.push_back(s1);
        }
      }
      a.push_back(s);
    }
  }
  printf("%d\n", a.size());
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << endl;
  }
}
