#include <bits/stdc++.h>
using namespace std;
priority_queue<int> q;
int n, j, x, i, c[1000009];
string a, b[1000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  while (n--) {
    cin >> a;
    if (a[0] == 'i') {
      cin >> x;
      c[j] = x;
      b[j++] = a;
      q.push(-1 * x);
    } else if (a[0] == 'g') {
      cin >> x;
      while (!q.empty() && -1 * q.top() < x) {
        b[j++] = "removeMin";
        q.pop();
      }
      if (q.empty() || -1 * q.top() > x) {
        b[j] = "insert";
        c[j++] = x;
        b[j] = "getMin";
        c[j++] = x;
        q.push(-1 * x);
      } else {
        b[j] = "getMin";
        c[j++] = x;
      }
    } else {
      if (q.empty()) {
        b[j] = "insert";
        c[j++] = 0;
        q.push(0);
      }
      q.pop();
      b[j++] = "removeMin";
    }
  }
  cout << j << endl;
  for (i = 0; i < j; i++) {
    cout << b[i];
    if (b[i][0] == 'i' || b[i][0] == 'g') cout << " " << c[i];
    cout << endl;
  }
  return 0;
}
