#include <bits/stdc++.h>
using namespace std;
priority_queue<int> p;
int a[1000100], n, k, q;
string aa[1000100], s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "insert") {
      cin >> k;
      aa[q++] = s;
      a[q - 1] = k;
      k *= (-1);
      p.push(k);
    }
    if (s == "getMin") {
      cin >> k;
      while (!p.empty() && -1 * p.top() < k) {
        p.pop();
        aa[q++] = "removeMin";
      }
      if (p.empty() || -1 * p.top() != k) {
        p.push(-k);
        aa[q++] = "insert";
        a[q - 1] = k;
      }
      aa[q++] = s;
      a[q - 1] = k;
    }
    if (s == "removeMin") {
      if (!p.empty())
        p.pop();
      else {
        aa[q++] = "insert";
        a[q - 1] = 2;
      }
      aa[q++] = s;
    }
  }
  cout << q << endl;
  for (int i = 0; i < q; i++) {
    if (aa[i] == "getMin" || aa[i] == "insert") {
      cout << aa[i] << ' ' << a[i] << endl;
    } else {
      cout << aa[i] << endl;
    }
  }
}
