Originally there were 22 male rabbits, meaning there were 40-22=18 female rabbits. The probability that a rabbit being picked at random is male being 1/2 means that half of the rabbits are male. So there is the same amount of male rabbits as there are female rabbits. This means there are (40-10)÷2=15 of both male and female rabbits left. So there were 22-15=7 male rabbits sold, and 18-15=3 female rabbits sold.