In a mathematics class, 20 children had forgotten their ruler and 17 had forgotten their pencil. The teacher asked them to go and borrow from their friends. If 24 children left the room, then the number of children who had forgotten both rulers and pencil are ______.