#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
const double eps = 1e-10;
const long long N = 2e5 + 7;
const long long MOD = 1e9 + 7;
long long pw(long long b, long long p) {
  b %= MOD;
  long long res = 1;
  while (p > 0) {
    if (p & 1) res = res * b % MOD;
    b = b * b % MOD;
    p >>= 1;
  }
  return res;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  multiset<long long> ms;
  vector<pair<string, long long>> s(n), ans;
  for (long long i = 0; i < n; i++) {
    cin >> s[i].first;
    if (s[i].first == "insert") {
      cin >> s[i].second;
      ans.emplace_back(s[i].first, s[i].second);
      ms.insert(s[i].second);
    } else if (s[i].first == "getMin") {
      cin >> s[i].second;
      if (ms.empty()) {
        ans.emplace_back("insert", s[i].second);
        ms.insert(s[i].second);
      }
      while (!ms.empty() && *ms.begin() < s[i].second) {
        ans.emplace_back("removeMin", -0x3f3f3f3f3f3f3f3fLL);
        ms.erase(ms.begin());
      }
      if (ms.empty() || (!ms.empty() && *ms.begin() != s[i].second)) {
        ms.insert(s[i].second);
        ans.emplace_back("insert", s[i].second);
      }
      ans.emplace_back(s[i].first, s[i].second);
    } else {
      s[i].second = -0x3f3f3f3f3f3f3f3fLL;
      if (ms.empty()) {
        ans.emplace_back("insert", 0LL);
        ms.insert(0LL);
      }
      ans.emplace_back(s[i].first, s[i].second);
      ms.erase(ms.begin());
    }
  }
  cout << ans.size() << '\n';
  for (auto i : ans) {
    cout << i.first;
    if (i.second != -0x3f3f3f3f3f3f3f3fLL) cout << ' ' << i.second;
    cout << '\n';
  }
  return 0;
}
