#include <bits/stdc++.h>
using namespace std;
int cmp(int a, int b) { return a < b ? 1 : 0; }
queue<pair<string, int> > p1;
priority_queue<int> q;
int v = 0;
void Insert(int x) {
  q.push(-x);
  p1.push(pair<string, int>("insert ", x));
  v++;
}
void getMin(int x) {
  while (q.size() > 0 && x > -q.top()) {
    q.pop();
    p1.push(pair<string, int>("removeMin", 2000000000));
    v++;
  }
  if (q.size() > 0 && x == -q.top()) {
    p1.push(pair<string, int>("getMin ", x));
    v++;
  }
  if (q.size() == 0 || (q.size() > 0 && x < -q.top())) {
    Insert(x);
    p1.push(pair<string, int>("getMin ", x));
    v++;
  }
}
void removeMin() {
  if (q.size() > 0) {
    q.pop();
    p1.push(pair<string, int>("removeMin", 2000000000));
    v++;
  } else {
    Insert(1);
    q.pop();
    p1.push(pair<string, int>("removeMin", 2000000000));
    v++;
  }
}
int main() {
  int n, x1;
  string s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "removeMin") {
      removeMin();
    } else {
      cin >> x1;
      if (s == "insert") {
        Insert(x1);
      }
      if (s == "getMin") {
        getMin(x1);
      }
    }
  }
  cout << v << endl;
  for (int i = 0; i < v; i++) {
    cout << p1.front().first;
    if (p1.front().second != 2000000000) {
      cout << p1.front().second << "\n";
      p1.pop();
    } else {
      cout << "\n";
      p1.pop();
    }
  }
  return 0;
}
