This may be clearer written as `x.count_ones() == 1`?