#include<bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

typedef long long ll;
typedef pair<int, int> P;

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  multiset<int> a;
  int q;
  cin >> q;
  vector<int> ans;
  rep(i,q) {
    int command; cin >> command;
    if (command == 0) {
      int x; cin >> x;
      a.insert(x);
      ans.push_back(a.size());
    } else if (command == 1) {
      int x; cin >> x;
      ans.push_back(a.count(x));
    } else if (command == 2) {
      int x; cin >> x;
      a.erase(x);
    } else if (command == 3) {
      int l, r; cin >> l >> r;      
      auto itrl = a.lower_bound(l);
      auto itrr = a.upper_bound(r);
      for (auto itr = itrl; itr != itrr; itr++)
      ans.push_back(*itr);
    }
  }

  for (auto a : ans) cout << a << endl;

  return 0;
}

