#include <iostream>
#include <unordered_set>

namespace std {
	template<>
	struct hash<unordered_multiset<int>> {
		typedef unordered_multiset<int> argument_type;
		typedef std::size_t result_type;
		
		const result_type BASE =  static_cast<result_type>(0xA67);
		
		result_type log_pow(result_type ex) const
		{
		    result_type res = 1;
		    result_type base = BASE;
		    while (ex > 0)
		    {
		        if (ex % 2)
		            res = res * base;
		        base *= base;
		        ex /= 2;
		    }
		    return res;
		}
		
		result_type operator()(argument_type const & val) const {
			result_type h = 0;
			for (const int& el : val) {
				h += log_pow(el);
			}
			return h;
		}
	};
};

	int main() {
		std::unordered_set<std::unordered_multiset<int>> mySet;
		std::unordered_multiset<int> set1{1,2,3,4};
		std::unordered_multiset<int> set2{1,1,2,2,3,3,4,4};
		std::cout << "Hash 1: " << std::hash<std::unordered_multiset<int>>()(set1) << std::endl;
		std::cout << "Hash 2: " << std::hash<std::unordered_multiset<int>>()(set2) << std::endl;
		return 0;
	}