#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 1e6 + 6, OO = 0x3f3f3f3f;
int n;
vector<pair<string, int> > ans;
priority_queue<int> pq;
int main() {
  char s[10];
  int p;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    p = 0;
    if (s[0] == 'i') {
      scanf("%d", &p);
      pq.push(-p);
      ans.push_back({s, p});
    } else if (s[0] == 'g') {
      scanf("%d", &p);
      while (!pq.empty() && -pq.top() < p) {
        pq.pop();
        ans.push_back({"removeMin", -1});
      }
      if (pq.empty() || p != -pq.top()) {
        pq.push(-p);
        ans.push_back({"insert", p});
      }
      ans.push_back({s, p});
    } else {
      if (pq.empty())
        ans.push_back({"insert", 0});
      else
        pq.pop();
      ans.push_back({s, p});
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); ++i) {
    if (ans[i].first[0] == 'r')
      cout << ans[i].first << endl;
    else
      cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
