works and returns a single number. Uses multisets