#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
struct node {
  int u;
  bool operator<(const node& p) const { return p.u < u; }
};
priority_queue<node> q;
char s[100];
vector<string> v;
vector<int> v1;
int main() {
  int n;
  node x;
  cin >> n;
  while (n--) {
    scanf("%s", s);
    if (s[0] == 'i') {
      scanf("%d", &x.u);
      q.push(x);
      v.push_back(s);
      v1.push_back(x.u);
    } else if (s[0] == 'g') {
      scanf("%d", &x.u);
      while (!q.empty() && q.top().u < x.u) {
        q.pop();
        v.push_back("removeMin");
      }
      if (q.empty() || q.top().u != x.u) {
        q.push(x);
        v.push_back("intsert");
        v1.push_back(x.u);
      }
      v.push_back(s);
      v1.push_back(x.u);
    } else {
      if (!q.empty()) {
        q.pop();
        v.push_back(s);
      } else {
        v.push_back("intsert");
        v1.push_back(0);
        v.push_back(s);
      }
    }
  }
  cout << v.size() << endl;
  int c1 = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i][0] == 'i')
      printf("insert %d\n", v1[c1++]);
    else if (v[i][0] == 'r')
      puts("removeMin");
    else
      printf("getMin %d\n", v1[c1++]);
  }
}
