#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  multiset<int> S;
  vector<string> ans;
  for (long long i = 0; i < (n); i++) {
    string s;
    cin >> s;
    if (s[0] == 'i') {
      int x;
      cin >> x;
      S.insert(x);
      stringstream ss;
      ss << "insert ";
      ss << x;
      string in;
      getline(ss, in);
      ans.push_back(in);
    } else if (s[0] == 'g') {
      int x;
      cin >> x;
      stringstream ss, ss1;
      string in;
      auto it = S.find(x);
      if (it == S.end()) {
        S.insert(x);
        ss << "insert ";
        ss << x;
        getline(ss, in);
        ans.push_back(in);
      }
      it = S.lower_bound(x);
      int len = distance(S.begin(), it);
      for (long long i = 0; i < (len); i++) {
        S.erase(S.begin());
        ans.push_back("removeMin");
      }
      ss1 << "getMin ";
      ss1 << x;
      getline(ss1, in);
      ans.push_back(in);
    } else {
      if (!S.size()) {
        ans.push_back("insert 1");
      }
      if (S.size()) S.erase(S.begin());
      ans.push_back("removeMin");
    }
  }
  cout << ans.size() << '\n';
  for (long long i = 0; i < (ans.size()); i++) cout << ans[i] << '\n';
  return 0;
}
