#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int q;
    cin>>q;

    multiset<int> Set;
    while(q--)
    {
        int op,x;
        cin>>op>>x;

        if(!op)
        {
            Set.insert(x);
            cout<<Set.size()<<endl;
        }else if(op==1)
        {
            cout<<Set.count(x)<<endl;
        }else if(op==2)
        {
            Set.erase(x);
        }else if(op==3)
        {
            int l=x,r,cnt=0;
            cin>>r;
            for(auto i=Set.lower_bound(l);i!=Set.end()&&*i<=r;i++)
                cout<<*i<<endl;
        }
    }

    return 0;
}


