#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mset(m,v) memset(m,v,sizeof(m))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi 3.1415926535897932384
#define mod 1000000007
#define MAXM 1000000001

string s[1000100];
string s1[1000100];

int a[1000100],a1[1000100];

struct compare
{
   bool operator()(const int& l, const int& r)
   {
       return l > r;
   }
};

priority_queue<int,vector<int>, compare > pq;

int main()
{

    int n,i,j,k;

    cin>>n;

    for(i=0;i<n;i++){
        cin>>s[i];
        if(s[i]!="removeMin"){
            cin>>a[i];
        }else
            a[i]=-34433423;
    }

    int cnt=0;

    for(i=0;i<n;i++)
    {
        // cout<<"hello"<<endl;
        if(s[i]=="insert"){
            s1[cnt]="insert";
            a1[cnt++]=a[i];
            pq.push(a[i]);
        }
        else if(s[i]=="removeMin"){
            if(!pq.empty()){
                pq.pop();
            }
            else{
                s1[cnt]="insert";
                a1[cnt++]=2;
                pq.pop();
            }
            s1[cnt]="removeMin";
            a1[cnt++]=-34433423;
        }
        else{
            if(pq.empty()) {
                s1[cnt]="insert";
                a1[cnt++]=a[i];
                s1[cnt]=s[i];
                a1[cnt++]=a[i];
            }
            else{
                int x=pq.top();
                if(x==a[i])
                {
                    s1[cnt]=s[i];
                    a1[cnt++]=a[i];
                }
                else
                {
                    while(!pq.empty() && x!=a[i]){
                        s1[cnt]="removeMin";
                        a1[cnt++]=-34433423;
                        pq.pop();
                        x=pq.top();
                    }
                    if(pq.empty()){
                        s1[cnt]="insert";
                        a1[cnt++]=a[i];
                    }
                    s1[cnt]=s[i];
                    a1[cnt++]=a[i];
                }
            }
        }
    }

    cout<<cnt<<endl;
    for(i=0;i<cnt;i++){
        cout<<s1[i];
        if(a1[i]!=-34433423)
            cout<<" "<<a1[i];
        cout<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mset(m,v) memset(m,v,sizeof(m))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi 3.1415926535897932384
#define mod 1000000007
const int MAXM =1e6+10;

pair<char , int> ans[MAXM];
int a[MAXM];

// struct compare
// {
//    bool operator()(const int& l, const int& r)
//    {
//        return l > r;
//    }
// };

priority_queue<int> pq;

int main()
{
    int cnt=0;
    int n,i,j,k;
    scanf("%d",&n);
    char s[1001];
    for(i=0;i<n;i++)
    {
        scanf("%s",s);
        if(s[0]=='i'){
            scanf("%d",&a[i]);
            pq.push(-a[i]);
            ans[cnt].fi='i';
            ans[cnt++].se=a[i];
        }
        else if(s[0]=='r'){
            if(pq.empty()){
                ans[cnt].fi='i';
                ans[cnt++].se=0;
                pq.push(0);
            }
            if(!pq.empty()){
                ans[cnt++].fi='r';
                pq.pop();
            }
        }
        else{
            cin>>a[i];
            // cout<<"fuck"<<endl;
            if(pq.empty()){
                pq.push(-a[i]);
                ans[cnt].fi='i';
                ans[cnt++].se=a[i];
                ans[cnt].fi='g';
                ans[cnt++].se=a[i];
            }
            else{
                // cout<<"suck"<<endl;
                if((-pq.top())==a[i]){
                    ans[cnt].fi='g';
                    ans[cnt++].se=a[i];
                }
                else{
                    // cout<<"gand"<<endl;
                    // cout<<pq.top()<<endl;
                    while(!pq.empty() && (-pq.top())<a[i]){
                        // cout<<"loda"<<endl;
                        pq.pop();
                        ans[cnt++].fi='r';
                    }
                    if(pq.empty()){
                        pq.push(-a[i]);
                        ans[cnt].fi='i';
                        ans[cnt++].se=a[i];
                    }
                    else{
                        if((-pq.top())!=a[i]){
                            pq.push(-a[i]);
                            ans[cnt].fi='i';
                            ans[cnt++].se=a[i];
                        }
                    }
                    ans[cnt].fi='g';
                    ans[cnt++].se=a[i];
                }
            }
        }
    }

    cout<<cnt<<endl;
    for(i=0;i<cnt;i++)
    {
        if(ans[i].fi=='r'){
            cout<<"removeMin"<<endl;
        }
        else{
            if(ans[i].fi=='g')
                cout<<"getMin";
            else
                cout<<"insert";
            cout<<" "<<ans[i].se<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mset(m,v) memset(m,v,sizeof(m))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pi 3.1415926535897932384
#define mod 1000000007
#define MAXM 1000000001

string s[1000100];
string s1[1000100];

int a[1000100],a1[1000100];

struct compare
{
   bool operator()(const int& l, const int& r)
   {
       return l > r;
   }
};

priority_queue<int,vector<int>, compare > pq;

int main()
{

    int n,i,j,k;

    cin>>n;

    for(i=0;i<n;i++){
        cin>>s[i];
        if(s[i]!="removeMin"){
            cin>>a[i];
        }else
            a[i]=-34433423;
    }

    int cnt=0;

    for(i=0;i<n;i++)
    {
        // cout<<"hello"<<endl;
        if(s[i]=="insert"){
            s1[cnt]="insert";
            a1[cnt++]=a[i];
            pq.push(a[i]);
        }
        else if(s[i]=="removeMin"){
            if(!pq.empty()){
                pq.pop();
            }
            else{
                s1[cnt]="insert";
                a1[cnt++]=2;
            }
            s1[cnt]="removeMin";
            a1[cnt++]=-34433423;
        }
        else{
            if(pq.empty()) {
                s1[cnt]="insert";
                a1[cnt++]=a[i];
                s1[cnt]=s[i];
                a1[cnt++]=a[i];
            }
            else{
                int x=pq.top();
                if(x==a[i])
                {
                    s1[cnt]=s[i];
                    a1[cnt++]=a[i];
                }
                else
                {
                    while(x!=a[i] && !pq.empty()){
                        s1[cnt]="removeMin";
                        a1[cnt++]=-34433423;
                        pq.pop();
                    }
                    if(pq.empty()){
                        s1[cnt]="insert";
                        a1[cnt++]=a[i];
                    }
                    s1[cnt]=s[i];
                    a1[cnt++]=a[i];
                }
            }
        }
    }

    cout<<cnt<<endl;
    for(i=0;i<cnt;i++){
        cout<<s1[i]<<" ";
        if(a1[i]!=-34433423)
            cout<<a1[i];
        cout<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>

#define ll long long

using namespace std;

typedef pair<string, ll> si;

vector<si> res;
priority_queue <ll, vector<ll>, greater<ll> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", -2147483647));
                q.push(-2147483647);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            int u = q.top();
            if (u != x) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin ", -1));
                    q.pop();
                    cnt++;
                }
                if (q.top() > x || q.empty()) {
                    q.push(x);
                    res.push_back(si("insert ", x));
                    cnt++;
                }
            }
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", 1));
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", -1000000001));
                q.push(-1000000001);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", -1000000000));
                q.push(-1000000000);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);

    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", 0));
                q.push(0);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);

    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", -1000000001));
                q.push(-1000000001);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);

    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", -2000000000));
                q.push(-2000000000);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;

int main() {
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    priority_queue <int, vector<int>, greater<int> > q;
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            cerr << "insert " << x << endl;
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            int u = q.top();
            if (u != x) {
                while (q.top() < x && !q.empty()) {
                    cerr << "removeMin" << endl;
                    res.push_back(si("removeMin ", -1));
                    q.pop();
                    cnt++;
                }
                if (q.top() > x || q.empty()) {
                    cerr << "insert " << x << endl;
                    q.push(x);
                    res.push_back(si("insert ", x));
                    cnt++;
                }
            }
            cerr << "getMin " << x << endl;
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                cerr << "insert 1" << endl;
                res.push_back(si("insert ", 1));
                cnt++;
            }
            q.pop();
            cerr << "removeMin" << endl;
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                int u = q.top();
                if (u < x) {
                    while (q.top() < x && !q.empty()) {
                        res.push_back(si("removeMin ", -1));
                        q.pop();
                        cnt++;
                    }
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", 1));
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);

    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) {res.push_back(si("insert ", x)); q.push(x);}
            else if (q.top() > x) {res.push_back(si("insert ", x)); q.push(x); }
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", 0));
                q.push(0);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                int u = q.top();
                if (u < x) {
                    while (q.top() < x && !q.empty()) {
                        res.push_back(si("removeMin ", -1));
                        q.pop();
                        cnt++;
                    }
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", -1000000000));
                q.push(-1000000000);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);

    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (!q.empty()) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", -1000000000));
                q.push(-1000000000);
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    cerr << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
        cerr << res[i].first;
        if (res[i].second != -1) cerr << res[i].second;
        cerr << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define PI 3.14159265358979323846264338327950
using namespace std;
vector<pair<string,ll> > ans;
multiset<ll> s;
multiset<ll>::iterator it;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    string a;
    ll n,i,f,x;
    cin>>n;
    for(i=0;i<n;i++)
    {
        ll c=0;
        f=0;
        cin>>a;
        if(a[0]=='g'||a[0]=='i')
        cin>>x;
        if(a[0]=='i')
        {
            s.insert(x);
            ans.push_back(make_pair("insert",x));
        }
        else if(a[0]=='g')
        {
                while(!s.empty()&&*s.begin()<x)
                {
                    ans.push_back(make_pair("removeMin",0));
                    s.erase(s.begin());
                }
                if(s.empty()||*s.begin()!=x)
                {
                    s.insert(x);
                    ans.push_back(make_pair("insert",x));
                }
                ans.push_back(make_pair("getMin",x));
        }
        else
        {
                if(s.empty())
                {
                    ans.push_back(make_pair("insert",-1000000000));
                    s.insert(-1000000000);
                }
                s.erase(s.begin());
            ans.push_back(make_pair("removeMin",0));

        }
    }
    cout<<ans.size()<<endl;
    for(i=0;i<ans.size();i++)
        {
            string temp=ans[i].first;
            if(temp[0]=='g'||temp[0]=='i')
            cout<<ans[i].first<<" "<<ans[i].second<<endl;
            else
                cout<<ans[i].first<<endl;
        }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (q.top() > x || q.empty()) {
                q.push(x);
                res.push_back(si("insert ", x));
                cnt++;
            } else {
                int u = q.top();
                if (u < x) {
                    while (q.top() < x && !q.empty()) {
                        res.push_back(si("removeMin ", -1));
                        q.pop();
                        cnt++;
                    }
                }
            }
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", 1));
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    freopen("in.txt", "r", stdin);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            if (q.top() > x || q.empty()) {
                q.push(x);
                res.push_back(si("insert ", x));
                cnt++;
            } else {
                int u = q.top();
                if (u < x) {
                    while (q.top() < x && !q.empty()) {
                        res.push_back(si("removeMin ", -1));
                        q.pop();
                        cnt++;
                    }
                }
            }
            if (q.empty()) res.push_back(si("insert ", x));
            else if (q.top() > x) res.push_back(si("insert ", x));
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", 1));
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<string, int> si;

vector<si> res;
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    ios_base::sync_with_stdio(NULL);
    int n, cnt = 0;
    cin >> n;
    while (n--) {
        string str;
        int x;
        cin >> str;
        if (str == "insert") {
            cin >> x;
            q.push(x);
            res.push_back(si("insert ", x));
        }
        if (str == "getMin") {
            cin >> x;
            int u = q.top();
            if (u < x) {
                while (q.top() < x && !q.empty()) {
                    res.push_back(si("removeMin ", -1));
                    q.pop();
                    cnt++;
                }
            }
            if (q.top() > x || q.empty()) {
                q.push(x);
                res.push_back(si("insert ", x));
                cnt++;
            }
            res.push_back(si("getMin ", x));
        }
        if (str == "removeMin") {
            if (q.empty()) {
                res.push_back(si("insert ", 1));
                cnt++;
            }
            q.pop();
            res.push_back(si("removeMin", -1));
        }
    }

    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++) {
        cout << res[i].first;
        if (res[i].second != -1) cout << res[i].second;
        cout << endl;
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                FOR(i, 1, S.size()) ans.push_back(SI("removeMin", 0));
                ans.push_back(SI("insert", x));
            }
            if (*it == x)
            {
                S.erase(S.begin(), it);
            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 0));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin") puts("removeMin"); else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            while (S.size() > 0 && *(S.begin()) < x)
            {
                ans.push_back(SI("removeMin", 0));
                S.erase(S.begin());
            }
            if (S.empty() || *(S.begin()) > x)
            {
                S.insert(x);
                ans.push_back(SI("insert", x));
            }
            ans.push_back(SI("getMin", x));
        } else if (st == "removeMin")
        {
            if (S.empty())
            {
                ans.push_back(SI("insert", 0));
                S.insert(0);
            }
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 0));
        }
    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin") puts("removeMin"); else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(SI("removeMin", S.size()));
                ans.push_back(SI("insert", x));
            }
            if (*it == x)
            {
                --it;
                S.erase(S.begin(), it);
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it) fre++;
                fre++;
                ans.push_back(SI("removeMin", fre));
            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <int, int> II;

multiset <int> S;

string st;

vector <II> ans;
int n, x;

void Read(int &n)
{
    n = 0;
    char c;
    bool sign = 0;
    do
    {
        c = getchar();
    } while (!isdigit(c) && c != '-');
    if (c == '-')
    {
        sign = 1;
        c = getchar();
    }
    do
    {
        n = (n << 1) + (n << 3) + c - 48;
        c = getchar();
    } while (isdigit(c));
    if (sign) n = -n;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            Read(x);
            S.insert(x);
            ans.push_back(II(1, x));
        } else if (st == "getMin")
        {
            Read(x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(II(3, S.size()));
                S.erase(S.begin(), S.end());
                S.insert(x);
                ans.push_back(II(1, x));
            } else
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(II(3, fre));
                S.erase(S.begin(), it);

            } else
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(II(3, fre));
                S.erase(S.begin(), it);
                S.insert(x);
                ans.push_back(II(1, x));

            }
            ans.push_back(II(2, x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(II(3, 1));
        }

    }
    int res = 0;
    for (int i = 0; i < ans.size(); ++i) if (ans[i].fi == 3) res += ans[i].se; else res++;
    printf("%d\n", res);
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == 3)
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            if (ans[i].fi == 1)
            {
                printf("insert %d\n", ans[i].se);
            } else
            {
                printf("getMin %d\n", ans[i].se);
            }
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            while (S.size() > 0 && *(S.begin()) < x)
            {
                ans.push_back(SI("removeMin", 0));
                S.erase(S.begin());
            }
            if (S.empty() || *(S.begin()) > x)
            {
                S.insert(x);
                ans.push_back(SI("insert", x));
            }
            ans.push_back(SI("getMin", x));
        } else if (st == "removeMin")
        {
            if (S.empty())
            {
                ans.push_back(SI("insert", 1));
                S.insert(1);
            }
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 0));
        }
    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin") puts("removeMin"); else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(SI("removeMin", S.size()));
                ans.push_back(SI("insert", x));
            }
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                --it;
                S.erase(S.begin(), it);

            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                S.erase(S.begin(), S.end());
                ans.push_back(SI("removeMin", S.size()));
                ans.push_back(SI("insert", x));
            }
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                --it;
                S.erase(S.begin(), it);

            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(SI("removeMin", S.size()));
                S.erase(S.begin(), S.end());
                S.insert(x);
                ans.push_back(SI("insert", x));
            } else
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                S.erase(S.begin(), it);

            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <int, int> II;

multiset <int> S;

string st;

vector <II> ans;
int n, x;

void Read(int &n)
{
    n = 0;
    char c;
    bool sign = 0;
    do
    {
        c = getchar();
    } while (!isdigit(c) && c != '-');
    if (c == '-')
    {
        sign = 1;
        c = getchar();
    }
    do
    {
        n = (n << 1) + (n << 3) + c - 48;
        c = getchar();
    } while (isdigit(c));
    if (sign) n = -n;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            Read(x);
            S.insert(x);
            ans.push_back(II(1, x));
        } else if (st == "getMin")
        {
            Read(x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(II(3, S.size()));
                S.erase(S.begin(), S.end());
                S.insert(x);
                ans.push_back(II(1, x));
            } else
            if (*it == x)
            {
                int fre = 0;
              //  for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(II(3, fre));
                S.erase(S.begin(), it);

            } else
            {
                int fre = 0;
              //  for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(II(3, fre));
                S.erase(S.begin(), it);
                S.insert(x);
                ans.push_back(II(1, x));

            }
            ans.push_back(II(2, x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(II(3, 1));
        }

    }
    int res = 0;
    for (int i = 0; i < ans.size(); ++i) if (ans[i].fi == 3) res += ans[i].se; else res++;
    printf("%d\n", res);
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == 3)
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            if (ans[i].fi == 1)
            {
                printf("insert %d\n", ans[i].se);
            } else
            {
                printf("getMin %d\n", ans[i].se);
            }
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(SI("removeMin", S.size()));
                ans.push_back(SI("insert", x));
            }
            if (*it == x)
            {
                --it;
                S.erase(S.begin(), it);
            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            while (S.size() > 0 && *(S.begin()) < x)
            {
                ans.push_back(SI("removeMin", 0));
                S.erase(S.begin());
            }
            if (S.empty() || *(S.begin()) > x)
            {
                S.insert(x);
                ans.push_back(SI("insert", x));
            }
            ans.push_back(SI("getMin", x));
        } else if (st == "removeMin")
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 0));
        }
    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin") puts("removeMin"); else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(SI("removeMin", S.size()));
                S.erase(S.begin(), S.end());
                S.insert(x);
                ans.push_back(SI("insert", x));
            } else
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                S.erase(S.begin(), it);

            } else
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                S.erase(S.begin(), it);
                S.insert(x);
                ans.push_back(SI("insert", x));

            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            while (S.size() > 0 && *(S.begin()) != x)
            {
                ans.push_back(SI("removeMin", 0));
                S.erase(S.begin());
            }
            if (S.empty())
            {
                S.insert(x);
                ans.push_back(SI("insert", x));
            }
            ans.push_back(SI("getMin", x));
        } else if (st == "removeMin")
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 0));
        }
    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin") puts("removeMin"); else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                FOR(i, 1, S.size()) ans.push_back(SI("removeMin", 0));
                ans.push_back(SI("insert", x));
            }
            if (*it == x)
            {
                --it;
                S.erase(S.begin(), it);
            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 0));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin") puts("removeMin"); else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(SI("removeMin", S.size()));
                S.erase(S.begin(), S.end());
                S.insert(x);
                ans.push_back(SI("insert", x));
            } else
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                S.erase(S.begin(), it);

            } else
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                S.erase(S.begin(), it);
                S.insert(x);
                ans.push_back(SI("insert", x));

            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    int res = 0;
    for (int i = 0; i < ans.size(); ++i) if (ans[i].fi == "removeMin") res += ans[i].se; else res++;
    printf("%d\n", res);
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <int, int> II;

multiset <int> S;

string st;

vector <II> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(II(1, x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(II(3, S.size()));
                S.erase(S.begin(), S.end());
                S.insert(x);
                ans.push_back(II(1, x));
            } else
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(II(3, fre));
                S.erase(S.begin(), it);

            } else
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(II(3, fre));
                S.erase(S.begin(), it);
                S.insert(x);
                ans.push_back(II(1, x));

            }
            ans.push_back(II(2, x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(II(3, 1));
        }

    }
    int res = 0;
    for (int i = 0; i < ans.size(); ++i) if (ans[i].fi == 3) res += ans[i].se; else res++;
    printf("%d\n", res);
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == 3)
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            if (ans[i].fi == 1)
            {
                cout << "insert " << ans[i].se << endl;
            } else
            {
                cout << "getMin " << ans[i].se << endl;
            }
        }
    }

}


#include <cstdio>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

#define FOR(x, a, b) for (int x = a; x <= b; ++x)
#define fi first
#define se second

using namespace std;

const int MAXN = 1e6 + 5;

typedef pair <string, int> SI;

multiset <int> S;

string st;

vector <SI> ans;
int n, x;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    scanf("%d", &n);

    FOR(i, 1, n)
    {
        cin >> st;
        if (st == "insert")
        {
            scanf("%d", &x);
            S.insert(x);
            ans.push_back(SI("insert", x));
        } else if (st == "getMin")
        {
            scanf("%d", &x);
            multiset <int> :: iterator it = lower_bound(S.begin(), S.end(), x);
            if (it == S.end())
            {
                ans.push_back(SI("removeMin", S.size()));
                S.erase(S.begin(), S.end());
                S.insert(x);
                ans.push_back(SI("insert", x));
            }
            if (*it == x)
            {
                int fre = 0;
                for (multiset <int> :: iterator it1 = S.begin(); it1 != it; ++it1) fre++;
                ans.push_back(SI("removeMin", fre));
                --it;
                S.erase(S.begin(), it);

            }
            ans.push_back(SI("getMin", x));
        } else
        {
            S.erase(S.begin());
            ans.push_back(SI("removeMin", 1));
        }

    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i)
    {
        if (ans[i].fi == "removeMin")
        {
            FOR(j, 1, ans[i].se) puts("removeMin");
        } else
        {
            cout << ans[i].fi << " " << ans[i].se << endl;
        }
    }

}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

multiset<int> ms;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[100001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                ms.erase(ms.begin());
                next[i++].op=2;
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                ms.insert(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!ms.empty()&&*ms.begin()<num){
                    ms.erase(ms.begin());
                    next[i++].op=2;
                }
                if(ms.empty()||*ms.begin()!=num){
                    ms.insert(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        ms.clear();
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

multiset<int> ms;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[100001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                ms.erase(ms.begin());
                next[i].op=2;
                next[i++].num=1;
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                ms.insert(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!ms.empty()&&*ms.begin()<num){
                    int res=ms.count(*ms.begin());
                    ms.erase(*ms.begin());
                    next[i].op=2;
                    next[i++].num=res;
                }
                if(ms.empty()||*ms.begin()!=num){
                    ms.insert(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                for(int l=0;l<next[k].num;l++){
                    printf("removeMin\n");
                }

            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        ms.clear();
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

struct cmp{

    bool operator()(int &a,int &b){
        return a>b;
    }

};

priority_queue<int,vector<int>,cmp> pq;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[1000001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                next[i++].op=2;
                pq.pop();
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                pq.push(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!pq.empty()&&pq.top()<num){
                    pq.pop();
                    next[i++].op=2;
                }
                if(pq.empty()||pq.top()!=num){
                    pq.push(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        while(!pq.empty()){
            pq.pop();
        }
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

multiset<int> ms;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[100001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                ms.erase(ms.begin());
                next[i++].op=2;
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                ms.insert(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!ms.empty()&&*ms.begin()<num){
                    int res=ms.count(*ms.begin());
                    ms.erase(*ms.begin());
                    for(int k=0;k<res;k++){
                        next[i++].op=2;
                    }
                }
                if(ms.empty()||*ms.begin()!=num){
                    ms.insert(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        ms.clear();
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

struct cmp{

    bool operator()(int &a,int &b){
        return a>b;
    }

};

priority_queue<int,vector<int>,cmp> pq;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[1000001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){

                if(!pq.empty()){
                    pq.pop();
                    next[i++].op=2;
                }
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                pq.push(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!pq.empty()&&pq.top()<num){
                    pq.pop();
                    next[i++].op=2;
                }
                if(pq.empty()||pq.top()!=num){
                    pq.push(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        while(!pq.empty()){
            pq.pop();
        }
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

struct cmp{

    bool operator()(int &a,int &b){
        return a>b;
    }

};

priority_queue<int,vector<int>,cmp> pq;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[1000001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                next[i++].op=2;
                if(!pq.empty()){
                    pq.pop();
                }
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                pq.push(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!pq.empty()&&pq.top()<num){
                    pq.pop();
                    next[i++].op=2;
                }
                if(pq.empty()||pq.top()!=num){
                    pq.push(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        while(!pq.empty()){
            pq.pop();
        }
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

struct cmp{

    bool operator()(int &a,int &b){
        return a>b;
    }

};

priority_queue<int,vector<int>,cmp> pq;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[100001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                if(pq.empty()){
                    continue;
                }
                pq.pop();
                next[i++].op=2;
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                pq.push(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!pq.empty()&&pq.top()<num){
                    pq.pop();
                    next[i++].op=2;
                }
                if(pq.empty()||pq.top()!=num){
                    pq.push(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        while(!pq.empty()){
            pq.pop();
        }
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

struct cmp{

    bool operator()(int &a,int &b){
        return a>b;
    }

};

priority_queue<int,vector<int>,cmp> pq;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[1000001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){

                if(!pq.empty()){
                    pq.pop();
                    next[i++].op=2;
                }
                else{
                    pq.push(1);
                    next[i].op=1;
                    next[i++].num=1;
                    pq.pop();
                    next[i++].op=2;
                }
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                pq.push(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!pq.empty()&&pq.top()<num){
                    pq.pop();
                    next[i++].op=2;
                }
                if(pq.empty()||pq.top()!=num){
                    pq.push(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        while(!pq.empty()){
            pq.pop();
        }
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

struct cmp{

    bool operator()(int &a,int &b){
        return a>b;
    }

};

priority_queue<int,vector<int>,cmp> pq;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[100001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                pq.pop();
                next[i++].op=2;
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                pq.push(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!pq.empty()&&pq.top()<num){
                    pq.pop();
                    next[i++].op=2;
                }
                if(pq.empty()||pq.top()!=num){
                    pq.push(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        while(!pq.empty()){
            pq.pop();
        }
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>

using namespace std;

struct cmp{

    bool operator()(int &a,int &b){
        return a>b;
    }

};

priority_queue<int,vector<int>,cmp> pq;
string op;
int num;

struct NEXT{
    short int op;
    int num;
};
struct NEXT next[100001];

int main()
{
    //freopen("C:\\Users\\Tankwoks\\Desktop\\in.txt","r",stdin);
    //freopen("C:\\Users\\Tankwoks\\Desktop\\out.txt","w",stdout);
    int t;
    while(~scanf("%d",&t)){
        memset(next,0,sizeof(next));
        int i=0;
        while(t--){
            cin>>op;
            if(op=="removeMin"){
                next[i++].op=2;
                if(pq.empty()){
                    continue;
                }
                pq.pop();
                continue;
            }
            scanf("%d",&num);
            if(op=="insert"){
                pq.push(num);
                next[i].op=1;
                next[i++].num=num;
            }
            else{
                while(!pq.empty()&&pq.top()<num){
                    pq.pop();
                    next[i++].op=2;
                }
                if(pq.empty()||pq.top()!=num){
                    pq.push(num);
                    next[i].op=1;
                    next[i++].num=num;
                }
                next[i].op=3;
                next[i++].num=num;
            }
        }
        printf("%d\n",i);
        for(int k=0;k<i;k++){
            if(next[k].op==1){
                printf("insert %d\n",next[k].num);
            }
            else if(next[k].op==2){
                printf("removeMin\n");
            }
            else{
                printf("getMin %d\n",next[k].num);
            }
        }
        while(!pq.empty()){
            pq.pop();
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    vector<pair<string,int> > op,res;
    map<int,int> m;
    scanf("%d",&n);
    char t[10];
    for(int i=0;i<n;i++)
    {
        scanf("%s",t);
        if(!strcmp(t,"insert"))
        {
            int x;
            scanf("%d",&x);
            op.push_back(make_pair("insert",x));

        }
        else if(!strcmp(t,"getMin"))
        {
            int x;
            scanf("%d",&x);
            op.push_back(make_pair("getMin",x));
        }
        else
        {
            op.push_back(make_pair("removeMin",1));
        }
    }

    int s = op.size();

    for(int i=0;i<n;i++)
    {
        if(op[i].first.compare("insert")==0)
        {
            res.push_back(op[i]);
            m[op[i].second]++;
            //cout<<m[op[i].second]<<endl;
        }
        else if(op[i].first.compare("removeMin")==0)
        {
            if(m.empty())
            {
                res.push_back(make_pair("insert",1));
                res.push_back(make_pair("removeMin",1));
            }
            else if(m.begin()->second > 0)
                {
                    m.begin()->second--;
                    res.push_back(make_pair("removeMin",1));
                    if(m.begin()->second==0)
                        m.erase(m.begin());
                }
            else
                m.erase(m.begin());
        }
        else if(op[i].first.compare("getMin")==0)
        {
            if(m.empty())
            {
                res.push_back(make_pair("insert",op[i].second));
                res.push_back(make_pair("getMin",op[i].second));
            }
            else
            {
                if(m.begin()->first!=op[i].second)
                {
                    //cout<<"Minimum "<<m.begin()->first<<endl;
                    map<int,int> :: iterator it,it2;
                    for(it=m.begin();it!=m.end();it++)
                    {
                        //cout<<it->first<<" "<<op[i].second<<endl;
                        if(it->first < op[i].second)
                        {
                            int p = it->second;
                            //cout<<"p : "<<p<<endl;
                            while(p--)
                            {
                                res.push_back(make_pair("removeMin",1));
                            }
                            it2=it;
                            m.erase(it2);
                        }
                        else
                            break;
                    }
                }

                if(m.begin()->first!=op[i].second)
                {
                res.push_back(make_pair("insert",op[i].second));
                res.push_back(make_pair("getMin",op[i].second));
                }
                else
                     res.push_back(make_pair("getMin",op[i].second));
            }

        }
    }

    int ans=res.size();
    cout<<ans<<endl;
    for(int i=0;i<ans;i++)
    {
        if(res[i].first.compare("insert")==0)
            cout<<"insert "<<res[i].second<<endl;
        else if(res[i].first.compare("getMin")==0)
            cout<<"getMin "<<res[i].second<<endl;
        else
            cout<<"removeMin"<<endl;

    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
        int n;
        cin>>n;
        char a[10];
        int x;
        priority_queue<int> q;
        vector<pair<string,int> > ans;
        for(int i=0;i<n;i++)
        {
            scanf("%s",a);
            if(strcmp(a,"insert")==0)
            {
                int x;
                cin>>x;

                ans.push_back(make_pair("insert",x));
                q.push(-x);

            }

            else if(strcmp(a,"getMin")==0)
            {
                int x;
                cin>>x;
                if(q.empty())
                {
                     ans.push_back(make_pair("insert",x));
                     ans.push_back(make_pair("getMin",x));
                     q.push(-x);

                }
                else
                {
                    while(!q.empty() && -q.top() < x)
                    {
                        ans.push_back(make_pair("removeMin",INT_MAX));
                        q.pop();
                    }

                    if(q.top()!=-x)
                    {
                        ans.push_back(make_pair("insert",x));
                        ans.push_back(make_pair("getMin",x));
                        q.push(-x);
                    }
                    else
                         ans.push_back(make_pair("getMin",x));
                }
            }
            else if(strcmp(a,"removeMin")==0)
            {
                if(q.empty())
                {
                    ans.push_back(make_pair("insert",0));
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
                else
                {
                    q.pop();
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
            }
        }
        cout<<ans.size()<<endl;
        for(int i=0;i<ans.size();i++)
        {
            if(ans[i].second!=INT_MAX)
                cout<<ans[i].first<<" "<<ans[i].second;
            else
                cout<<ans[i].first;
            cout<<endl;
        }
        return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
        int n;
        cin>>n;
        char a[10];
        int x;
        priority_queue<int> q;
        vector<pair<string,int> > ans;
        for(int i=0;i<n;i++)
        {
            scanf("%s",a);
            if(strcmp(a,"insert")==0)
            {
                int x;
                scanf("%d",&x);

                ans.push_back(make_pair("insert",x));
                q.push(-x);

            }

            else if(strcmp(a,"getMin")==0)
            {
                int x;
                scanf("%d",&x);
                if(q.empty())
                {
                     ans.push_back(make_pair("insert",x));
                     ans.push_back(make_pair("getMin",x));
                     q.push(-x);

                }
                else
                {
                    while(!q.empty() && -q.top() < x)
                    {
                        ans.push_back(make_pair("removeMin",INT_MAX));
                        q.pop();
                    }

                    if(q.empty() || -q.top() > x )
                    {
                        ans.push_back(make_pair("insert",x));
                        ans.push_back(make_pair("getMin",x));
                        q.push(-x);
                    }
                    else
                         ans.push_back(make_pair("getMin",x));
                }
            }
            else if(strcmp(a,"removeMin")==0)
            {
                if(q.empty())
                {
                    ans.push_back(make_pair("insert",0));
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
                else
                {
                    q.pop();
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
            }
        }
        cout<<ans.size()<<endl;
        for(int i=0;i<ans.size();i++)
        {
            if(ans[i].second!=INT_MAX)
                cout<<ans[i].first<<" "<<ans[i].second;
            else
                cout<<ans[i].first;
            cout<<endl;
        }
        return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
        int n;
        cin>>n;
        char a[10];
        int x;
        priority_queue<int> q;
        vector<pair<string,int> > ans;
        for(int i=0;i<n;i++)
        {
            scanf("%s",a);
            if(strcmp(a,"insert")==0)
            {
                int x;
                scanf("%d",&x);

                ans.push_back(make_pair("insert",x));
                q.push(-x);

            }

            else if(strcmp(a,"getMin")==0)
            {
                int x;
                scanf("%d",&x);
                if(q.empty())
                {
                     ans.push_back(make_pair("insert",x));
                     ans.push_back(make_pair("getMin",x));
                     q.push(-x);

                }
                else
                {
                    while(!q.empty() && -q.top() < x)
                    {
                        ans.push_back(make_pair("removeMin",INT_MAX));
                        q.pop();
                    }

                    if(q.empty() || -q.top() > x )
                    {
                        ans.push_back(make_pair("insert",x));
                        ans.push_back(make_pair("getMin",x));
                        q.push(-x);
                    }
                    else
                         ans.push_back(make_pair("getMin",x));
                }
            }
            else if(strcmp(a,"removeMin")==0)
            {
                if(q.empty())
                {
                    ans.push_back(make_pair("insert",0));
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
                else
                {
                    q.pop();
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
            }
        }
        cout<<ans.size()<<endl;
        for(int i=0;i<ans.size();i++)
        {
            if(ans[i].second!=INT_MAX)
                printf("%s %d\n",ans[i].first,ans[i].second);
            else
                printf("%s\n",ans[i].first);

        }
        return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
        int n;
        cin>>n;
        char a[10];
        int x;
        priority_queue<int> q;
        vector<pair<string,int> > ans;
        for(int i=0;i<n;i++)
        {
            scanf("%s",a);
            if(strcmp(a,"insert")==0)
            {
                int x;
                cin>>x;

                ans.push_back(make_pair("insert",x));
                q.push(-x);

            }

            else if(strcmp(a,"getMin")==0)
            {
                int x;
                cin>>x;
                if(q.empty())
                {
                     ans.push_back(make_pair("insert",x));
                     ans.push_back(make_pair("getMin",x));
                     q.push(-x);

                }
                else
                {
                    while(!q.empty() && -q.top() < x)
                    {
                        ans.push_back(make_pair("removeMin",INT_MAX));
                        q.pop();
                    }

                    if(q.empty() ||-q.top() > x )
                    {
                        ans.push_back(make_pair("insert",x));
                        ans.push_back(make_pair("getMin",x));
                        q.push(-x);
                    }
                    else
                         ans.push_back(make_pair("getMin",x));
                }
            }
            else if(strcmp(a,"removeMin")==0)
            {
                if(q.empty())
                {
                    ans.push_back(make_pair("insert",0));
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
                else
                {
                    q.pop();
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
            }
        }
        cout<<ans.size()<<endl;
        for(int i=0;i<ans.size();i++)
        {
            if(ans[i].second!=INT_MAX)
                cout<<ans[i].first<<" "<<ans[i].second;
            else
                cout<<ans[i].first;
            cout<<endl;
        }
        return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
        int n;
        cin>>n;
        char a[10];
        int x;
        priority_queue<int> q;
        vector<pair<string,int> > ans;
        for(int i=0;i<n;i++)
        {
            scanf("%s",a);
            if(strcmp(a,"insert")==0)
            {
                int x;
                cin>>x;

                ans.push_back(make_pair("insert",x));
                q.push(-x);

            }

            else if(strcmp(a,"getMin")==0)
            {
                int x;
                cin>>x;
                if(q.empty())
                {
                     ans.push_back(make_pair("insert",x));
                     ans.push_back(make_pair("getMin",x));
                     q.push(-x);

                }
                else
                {
                    while(-q.top() > x && !q.empty())
                    {
                        ans.push_back(make_pair("removeMin",INT_MAX));
                        q.pop();
                    }

                    if(q.top()!=x)
                    {
                        ans.push_back(make_pair("insert",x));
                        ans.push_back(make_pair("getMin",x));
                        q.push(-x);
                    }
                    else
                         ans.push_back(make_pair("getMin",x));
                }
            }
            else if(strcmp(a,"removeMin")==0)
            {
                if(q.empty())
                {
                    ans.push_back(make_pair("insert",0));
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
                else
                {
                    q.pop();
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
            }
        }
        cout<<ans.size();
        for(int i=0;i<ans.size();i++)
        {
            if(ans[i].second!=INT_MAX)
                cout<<ans[i].first<<" "<<ans[i].second;
            else
                cout<<ans[i].first;
            cout<<endl;
        }
        return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
        int n;
        cin>>n;
        char a[10];
        int x;
        priority_queue<int> q;
        vector<pair<string,int> > ans;
        for(int i=0;i<n;i++)
        {
            scanf("%s",a);
            if(strcmp(a,"insert")==0)
            {
                int x;
                cin>>x;

                ans.push_back(make_pair("insert",x));
                q.push(-x);

            }

            else if(strcmp(a,"getMin")==0)
            {
                int x;
                cin>>x;
                if(q.empty())
                {
                     ans.push_back(make_pair("insert",x));
                     ans.push_back(make_pair("getMin",x));
                     q.push(-x);

                }
                else
                {
                    while(-q.top() > -x && !q.empty())
                    {
                        ans.push_back(make_pair("removeMin",INT_MAX));
                        q.pop();
                    }

                    if(q.top()!=-x)
                    {
                        ans.push_back(make_pair("insert",x));
                        ans.push_back(make_pair("getMin",x));
                        q.push(-x);
                    }
                    else
                         ans.push_back(make_pair("getMin",x));
                }
            }
            else if(strcmp(a,"removeMin")==0)
            {
                if(q.empty())
                {
                    ans.push_back(make_pair("insert",0));
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
                else
                {
                    q.pop();
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
            }
        }
        cout<<ans.size()<<endl;
        for(int i=0;i<ans.size();i++)
        {
            if(ans[i].second!=INT_MAX)
                cout<<ans[i].first<<" "<<ans[i].second;
            else
                cout<<ans[i].first;
            cout<<endl;
        }
        return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
        int n;
        cin>>n;
        char a[10];
        int x;
        priority_queue<int> q;
        vector<pair<string,int> > ans;
        for(int i=0;i<n;i++)
        {
            scanf("%s",a);
            if(strcmp(a,"insert")==0)
            {
                int x;
                cin>>x;

                ans.push_back(make_pair("insert",x));
                q.push(-x);

            }

            else if(strcmp(a,"getMin")==0)
            {
                int x;
                cin>>x;
                if(q.empty())
                {
                     ans.push_back(make_pair("insert",x));
                     ans.push_back(make_pair("getMin",x));
                     q.push(-x);

                }
                else
                {
                    while(-q.top() > -x && !q.empty())
                    {
                        ans.push_back(make_pair("removeMin",INT_MAX));
                        q.pop();
                    }

                    if(q.top()!=x)
                    {
                        ans.push_back(make_pair("insert",x));
                        ans.push_back(make_pair("getMin",x));
                        q.push(-x);
                    }
                    else
                         ans.push_back(make_pair("getMin",x));
                }
            }
            else if(strcmp(a,"removeMin")==0)
            {
                if(q.empty())
                {
                    ans.push_back(make_pair("insert",0));
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
                else
                {
                    q.pop();
                    ans.push_back(make_pair("removeMin",INT_MAX));
                }
            }
        }
        cout<<ans.size()<<endl;
        for(int i=0;i<ans.size();i++)
        {
            if(ans[i].second!=INT_MAX)
                cout<<ans[i].first<<" "<<ans[i].second;
            else
                cout<<ans[i].first;
            cout<<endl;
        }
        return 0;
}