#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<string, int> > vp;
  priority_queue<int, vector<int>, greater<int> > pq;
  for (int i = 0; i < n; ++i) {
    string str;
    cin >> str;
    if (str == "insert") {
      int num;
      cin >> num;
      pq.push(num);
      vp.push_back({str, num});
    } else if (str == "removeMin") {
      if (!pq.empty())
        pq.pop();
      else
        vp.push_back({"insert", 0});
      vp.push_back({str, -1});
    } else {
      int num;
      cin >> num;
      while (!pq.empty() && pq.top() < num) {
        pq.pop();
        vp.push_back({"removeMin", -1});
      }
      if (pq.empty() || pq.top() != num) {
        pq.push(num);
        vp.push_back({"insert", num});
      }
      vp.push_back({str, num});
    }
  }
  cout << vp.size() << "\n";
  for (int i = 0; i < vp.size(); ++i) {
    cout << vp[i].first;
    if (vp[i].first != "removeMin") cout << " " << vp[i].second;
    cout << "\n";
  }
  return 0;
}
