MOB-2275 Calculate background color for map tiles' sets

If you combine the collecting and counting steps into one, you'll save some memory (from the duplicate items) and one loop for the counting step.