#include <bits/stdc++.h>
using namespace std;
void read() { freopen("in", "r", stdin); }
vector<pair<string, int> > v;
vector<pair<string, int> > ans;
int n;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  v.resize(n + 5);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first;
    if (v[i].first != "removeMin") cin >> v[i].second;
  }
  multiset<int> se;
  for (int i = 0; i < n; i++) {
    if (v[i].first == "removeMin") {
      if (se.empty()) {
        ans.push_back(make_pair("insert", 1));
      } else {
        se.erase(se.begin());
      }
    } else if (v[i].first[0] == 'g') {
      if (!se.count(v[i].second)) {
        se.insert(v[i].second);
        ans.push_back(make_pair("insert", v[i].second));
      }
      while (*se.begin() != v[i].second) {
        ans.push_back(make_pair("removeMin", 0));
        se.erase(se.begin());
      }
    } else {
      se.insert(v[i].second);
    }
    ans.push_back(v[i]);
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " ";
    if (ans[i].first != "removeMin") cout << ans[i].second;
    cout << endl;
  }
}
