Yes you are correct.
I will explain here how we got that.
For a given number of binary digits (say x), 2^x gives the number of different binary numbers that can be made from it.
So when we consider the number of '0' bits in the subnet mask, we can find out the number of different binary numbers that can be made from it using the above formula. However, in a subnetwork two numbers out of these possible different binary numbers is reserved to make the Network address and the Broadcast address. These are formed by combining the network portion of the IP address with the 1st possible combination and the last possible combination of the number of bits under the host portion of the IP address receptively.
Let me explain this through an example.
11000000 10101000 11010001 10110000 - IP address
11111111 11111111 11111111 11110000 - Subnet mask
There are 4 '0' bits in the subnet mask. 2^4=16. The combinations are 0000, 0001, 0010, ... , 1101, 1110, 1111.
Combining the network portion of the IP address (11000000 10101000 11010001 1011) with the 1st combination (0000) gives us 11000000 10101000 11010001 10110000 which when converted to decimal is 192.168.209.176. This is the Host address for this subnet.
Combining the network portion of the IP address (11000000 10101000 11010001 1011) with the last combination (1111) gives us 11000000 10101000 11010001 10111111 which when converted to decimal is 192.168.209.191. This is the broadcast address for this subnet.
As you have stated in your question, we have to substract 2 addresses, the Network address and the broadcast addresses because we cannot assign them to hosts. Therefore we can modify the above equation to obtain the number of hosts in a subnetwork as (2^x)-2 where x is the number of host bits in the subnet mask
Now consider 192.168.209.176/31.
Since there is only 1 host bit in the subnet mask, 2 addresses can be formed. But since we must reserve 2 addresses for the network address and broadcast address, we are not left with any addresses to be assigned to hosts. (2^2)-2=0.
Therefore a subnetwork with /31 useless.