#include <bits/stdc++.h>
using namespace std;
struct compare {
  bool operator()(const int &l, const int &r) { return l > r; }
};
priority_queue<int, vector<int>, compare> my_heap;
vector<pair<string, int> > v;
int main() {
  int n, m = 0;
  cin >> n;
  while (n--) {
    string s;
    cin >> s;
    if (s == "insert") {
      int t;
      cin >> t;
      my_heap.push(t);
      m++;
      v.push_back({s, t});
    } else if (s == "removeMin") {
      if (my_heap.size() == 0) {
        v.push_back({"insert", 1});
        m++;
      } else
        my_heap.pop();
      m++;
      v.push_back({s, 0});
    } else {
      int t;
      cin >> t;
      if (my_heap.size() == 0) {
        m++;
        my_heap.push(t);
        v.push_back({"insert", t});
      } else {
        while (my_heap.top() < t && my_heap.size() > 0) {
          my_heap.pop();
          m++;
          v.push_back({"removeMin", 0});
        }
        if (my_heap.top() == t)
          ;
        else {
          m++;
          my_heap.push(t);
          v.push_back({"insert", t});
        }
      }
      m++;
      v.push_back({s, t});
    }
  }
  cout << m << endl;
  for (int i = 0; i < v.size(); i++) {
    string t = v[i].first;
    if (t == "removeMin")
      cout << t << endl;
    else
      cout << t << " " << v[i].second << endl;
  }
}
