#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <functional>
#include <set>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif


int main(){
	int q, com;
	long x;
	long L, R;
	std::multiset<long> s;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	ifs >> q;
#else
	std::cin >> q;
#endif
	
	for(int i = 0; i < q; i++){
#if INPUT_FROM_FILE
		ifs >> com >> x;
#else
		std::cin >> com >> x;
#endif
		if(com == 0){
			s.insert(x);
			std::cout << s.size() << std::endl;
		}
		else if(com == 1){
			std::cout << s.count(x) << std::endl;
		}
		else if(com == 2){
			s.erase(x);
		}
		else{
			L = x;
#if INPUT_FROM_FILE
			ifs >> R;
#else
			std::cin >> R;
#endif
			std::set<long>::iterator it = s.lower_bound(L);
			while(it != s.end() && *it <= R){
				std::cout <<  *it << std::endl;
				it++;
			}
		}
	}
	return 0;
}
