#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > q;
string s;
vector<pair<string, int> > ans;
int main() {
  int T, n;
  ios::sync_with_stdio(false);
  cin >> T;
  while (T--) {
    cin >> s;
    if (s[0] == 'i') {
      cin >> n;
      ans.push_back(make_pair(s, n));
      q.push(n);
    } else if (s[0] == 'r') {
      if (q.empty()) ans.push_back(make_pair("insert", 1e9)), q.push(1e9);
      ans.push_back(make_pair(s, 0));
      q.pop();
    } else {
      cin >> n;
      while (!q.empty() && q.top() < n) {
        q.pop();
        ans.push_back(make_pair("removeMin", 0));
      }
      if (q.empty() || q.top() != n) {
        q.push(n);
        ans.push_back(make_pair("insert", n));
      }
      ans.push_back(make_pair(s, q.top()));
    }
  }
  cout << ans.size() << "\n";
  for (auto i : ans) {
    if (i.first[0] == 'r')
      cout << "removeMin\n";
    else
      cout << i.first << " " << i.second << "\n";
  }
  return 0;
}
