#include <bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
using namespace std;

int main()
{  
    int n;
    cin>>n;
    multiset<int>s;
    REP(i,n)
    {
        int x,y;
        cin>>x>>y;
        if(x==0){s.insert(y);cout<<s.size()<<endl;}
        if(x==1)cout<<s.count(y)<<endl;
        if(x==2)
        {
            if(s.find(y)!=s.end())s.erase(y);
        }
        if(x==3)
        {
            int z;
            cin>>z;
            decltype(s)::iterator it=s.lower_bound(y);
            decltype(s)::iterator end=s.upper_bound(z);
            while(it!=end)
            {
                cout<<*it<<endl;
                ++it;
            }
        }
    }
}

