#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
char ts[100000];
string s;
int i, j, n, x;
multiset<int> m;
vector<pair<char, int> > q, ans;
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s", ts);
    s = string(ts);
    if (s == "insert") {
      scanf("%d\n", &x);
      q.push_back(make_pair('i', x));
    } else if (s == "getMin") {
      scanf("%d\n", &x);
      q.push_back(make_pair('g', x));
    } else {
      q.push_back(make_pair('r', 0));
      scanf("\n");
    }
  }
  for (i = 0; i < n; i++) {
    if (q[i].first == 'i') {
      m.insert(q[i].second);
      ans.push_back(q[i]);
    } else if (q[i].first == 'g') {
      while (!m.empty() && (*(m.begin())) < q[i].second) {
        ans.push_back(make_pair('r', 0));
        m.erase(m.begin());
      }
      if (m.empty() || q[i].second < (*(m.begin())))
        ans.push_back(make_pair('i', q[i].second)), m.insert(q[i].second);
      ans.push_back(q[i]);
    } else {
      if (m.empty())
        ans.push_back(make_pair('i', 0));
      else
        m.erase(m.begin());
      ans.push_back(q[i]);
    }
  }
  printf("%d\n", ans.size());
  for (i = 0; i < ans.size(); i++) {
    if (ans[i].first == 'i') {
      printf("insert %d\n", ans[i].second);
    } else if (ans[i].first == 'g') {
      printf("getMin %d\n", ans[i].second);
    } else {
      printf("removeMin\n");
    }
  }
  return 0;
}
