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