VLAN B has 21 hosts. IP address of 192.168.173.57

What is the subnet mask in use in this network?

My thought process is to add together the hosts totaling 50, then count the powers of 2 until I reach a number big enough which is 64. So my mask would be 255.255.255.192, right? Wrong. The correct answer is 255.255.255.224 - making 32 the number we stop on.

My question is why don't we add the total number of hosts between the two networks?

Hosts = 2^h - 2 = 2^5 - 2 = 30. I can only have 30 hosts when using the subnet mask of 255.255.255.224. I need 50 hosts between the two VLANs though.

How come we don't add the required hosts together and instead just calculate the subnet mask based on the highest required hosts between the two VLANS?

Thank you,

Chris