That is correct. Another way to do it is like this:
With two people (A and B), there is one handshake
(A with B).
With three people (A, B, and C), there are three handshakes
(A with B and C; B with C).
With four people (A, B, C, and D), there are six handshakes
(A with B, C...