#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 7, inf = 999999999999;
long long int a[N], b[N], cnt, sum, mx;
vector<pair<string, long long int>> v;
priority_queue<long long int, vector<long long int>, greater<long long int>> pq;
long long int kk;
stack<long long int> st;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int z = 0, n, m = 0, mx = 0, i = 0, x = 0, y = 0, k, j = 0;
  string s, r;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> s;
    if (s[0] == 'i') {
      cin >> x;
      v.push_back({s, x});
      pq.push(x);
    } else if (s[0] == 'g') {
      cin >> x;
      while (!pq.empty() && pq.top() < x) {
        pq.pop();
        v.push_back({"removeMin", inf});
      }
      if (pq.empty() || pq.top() != x) {
        pq.push(x);
        v.push_back({"insert", x});
      }
      v.push_back({s, x});
    } else {
      if (!pq.empty()) {
        pq.pop();
        v.push_back({s, inf});
      } else {
        v.push_back({"insert", 0});
        v.push_back({s, inf});
      }
    }
  }
  cout << v.size() << endl;
  for (i = 0; i < v.size(); i++) {
    if (v[i].first == "removeMin")
      cout << "removeMin\n";
    else
      cout << v[i].first << " " << v[i].second << "\n";
  }
}
