#include <bits/stdc++.h>

using namespace std;

multiset<int> ms;

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

  cin >> q;
  while(q--) {
    int a, x;
    cin >> a >> x;
    if (a == 0) {
      ms.insert(x);
      cout << ms.size() << endl;
    }
    else if (a == 1) {
      cout << ms.count(x) << endl;
    }
    else if (a == 2) {
      ms.erase(x);
    }
    else if (a == 3) {
      int y;
      cin >> y;
      auto aa = ms.lower_bound(x);
      auto bb = ms.upper_bound(y);
      for(auto it = aa; it != bb; it++) {
        cout << *it << endl;
      }
    }
  }
  return 0;
}

