#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll my_exp(ll a, ll b) {
  if (b == 0) {
    return 1;
  } else {
    ll temp = my_exp(a, b / 2);
    temp *= temp;
    if (b % 2 == 1) {
      temp *= a;
    }
    return temp;
  }
}
class mycomparison {
  bool reverse;

 public:
  mycomparison(const bool& revparam = false) { reverse = revparam; }
  bool operator()(const ll& lhs, const ll& rhs) const {
    if (reverse)
      return (lhs > rhs);
    else
      return (lhs < rhs);
  }
};
int main() {
  std::priority_queue<ll, std::vector<ll>, greater<ll> > fourth;
  ll n, m;
  vector<ll> insert, getMin, removeMin;
  vector<pair<ll, ll> > order;
  std::cin >> n;
  string a;
  for (ll i = 0; i < n; ++i) {
    std::cin >> a;
    if (a != "removeMin") scanf(" %lld\n", &m);
    if (a == "insert") {
      order.push_back(make_pair(0, m));
      fourth.push(m);
    }
    if (a == "removeMin") {
      if (fourth.empty()) {
        order.push_back(make_pair(0, 1));
        fourth.push(1);
      }
      order.push_back(make_pair(1, 1));
      fourth.pop();
    }
    if (a == "getMin") {
      if (fourth.empty()) {
        order.push_back(make_pair(0, m));
        fourth.push(m);
      }
      while (fourth.top() < m) {
        fourth.pop();
        order.push_back(make_pair(1, m));
        if (fourth.empty()) {
          order.push_back(make_pair(0, m));
          fourth.push(m);
        }
      }
      if (fourth.top() == m) {
        order.push_back(make_pair(3, m));
      } else {
        fourth.push(m);
        order.push_back(make_pair(0, m));
        order.push_back(make_pair(3, m));
      }
    }
  }
  std::cout << (ll)order.size() << std::endl;
  for (typeof(order.begin()) it = order.begin(); it != order.end(); it++) {
    if ((*it).first == 0) {
      std::cout << "insert " << (*it).second << std::endl;
    }
    if ((*it).first == 1) {
      std::cout << "removeMin" << std::endl;
    }
    if ((*it).first == 3) {
      std::cout << "getMin " << (*it).second << std::endl;
    }
  }
  return 0;
}
