#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#define int long long
using namespace std;
signed main() {
	multiset<int>s;
	int w; cin >> w;
	for (int i = 0; i < w; i++) {
		int n, x, l, r; cin >> n;
		if (n == 0) {
			cin >> x;
			s.insert(x);
			cout << s.size() << endl;
		}
		else if (n == 1) {
			cin >> x;
			cout << s.count(x) << endl;
		}
		else if (n == 2) {
			cin >> x;
			s.erase(x);
		}
		else {
			cin >> l >> r;
			for (auto i = s.lower_bound(l); i != s.upper_bound(r); i++)cout << *i << endl;
		}
	}
}
