Out of 40 people, 17 have brothers, 22 have sisters and 9 have both. How many people have neither brothers nor sisters?

Number (brothers OR sisters) = 17+22-9 = 30

but we had 40 people, so 10 had neither brothers or sisters