#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
int n;
pair<char, int> ans[maxn];
priority_queue<int, vector<int>, greater<int>> que;
int main() {
  scanf("%d", &n);
  int m = 0;
  for (int i = 1; i <= n; i++) {
    char op[15];
    int x;
    scanf("%s", op);
    if (op[0] != 'r') scanf("%d", &x);
    if (op[0] == 'i') {
      que.push(x);
      ans[++m] = make_pair('i', x);
    } else if (op[0] == 'g') {
      if (que.empty() || x < que.top()) {
        que.push(x);
        ans[++m] = make_pair('i', x);
      } else {
        while (!que.empty() && x > que.top()) {
          ans[++m] = make_pair('r', 0);
          que.pop();
        }
        if (que.empty() || x < que.top()) {
          que.push(x);
          ans[++m] = make_pair('i', x);
        }
      }
      ans[++m] = make_pair('g', x);
    } else {
      if (que.empty())
        ans[++m] = make_pair('i', 1);
      else
        que.pop();
      ans[++m] = make_pair('r', 0);
    }
  }
  cout << m << endl;
  for (int i = 1; i <= m; i++) {
    if (ans[i].first == 'r') printf("removeMin ");
    if (ans[i].first == 'i') printf("insert ");
    if (ans[i].first == 'g') printf("getMin ");
    if (ans[i].first != 'r') printf("%d", ans[i].second);
    printf("\n");
  }
  return 0;
}
