expectation number shake hands from same country

Here is a brainstorm of probability:

For 18 people, 9 from country A and 9 from country B. They sit in a circle and shake hands if the person next to them is from the same country, otherwise they don't shake hands. What's the expectation of total number of handshakes?

I know how to solve when people sit in a line: if two of people are from same country, choose any two of seats for them, the probability of sitting adjacently are

$$P = \dfrac{17\times2}{P^{18}_2}=\dfrac{17\times2}{18\times17}=\dfrac{1}{9}.$$

The possibilities that two of people are from same country are

$$C_2^9\times2=\dfrac{9\times8}{1\times2}\times2=72.$$

Therefore the expectation is

$$E = \dfrac{1}{9}\times72=8.$$

But for the circle case, there are a lot of duplicate case, I don't know how to deal with.


The probability a given person shakes hands with the person to their left is $\frac{8}{17}$ (since there are $17$ people who may be sitting to their left, $8$ of whom they would shake hands with). So the expected number of people who shake hands with the person to their left is $18\times 8/17$. This is also the expected number of handshakes, since each handshake involves exactly one person shaking hands with someone to their left.

Incidentally, this also does the line version. In this case you need to look at the probability that the person in a given position shakes hands with the person to their left; this is $8/17$ for every position except the leftmost one (where it is $0$), so you get $17\times 8/17$ in this case.