At first, the magazines in a library were placed on 23 shelves with an equal number of magazines on each shelf. 3 shelves were removed and the books on these shelves were placed on the remaining shelves. Because of this, the number of magazines on each remaining shelf increased by 9. What was the number of magazines on each shelf at first?