#include <bits/stdc++.h>
using namespace std;
long long int n, a1;
string s;
multiset<long long int> h;
pair<long long int, long long int> op[400000];
long long int ans = 0;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s[0] != 'r') cin >> a1;
    if (s[0] == 'r') {
      if (!h.empty()) {
        op[ans++] = (make_pair(2, 0));
        h.erase(h.begin());
      } else {
        op[ans++] = (make_pair(1, 1));
        op[ans++] = (make_pair(2, 0));
      }
    } else if (s[0] == 'g') {
      while (*h.begin() < a1 && !h.empty()) {
        op[ans++] = (make_pair(2, 0));
        h.erase(h.begin());
      }
      if (!h.empty()) {
        if (*h.begin() == a1)
          op[ans++] = (make_pair(3, a1));
        else {
          op[ans++] = (make_pair(1, a1));
          op[ans++] = (make_pair(3, a1));
          h.insert(a1);
        }
      } else {
        op[ans++] = (make_pair(1, a1));
        h.insert(a1);
        op[ans++] = (make_pair(3, a1));
      }
    } else if (s[0] == 'i') {
      op[ans++] = (make_pair(1, a1));
      h.insert(a1);
    }
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    if (op[i].first == 1) {
      cout << "insert " << op[i].second << endl;
    } else if (op[i].first == 2) {
      cout << "removeMin" << endl;
    } else if (op[i].first == 3) {
      cout << "getMin " << op[i].second << endl;
    }
  }
  return 0;
}
