A farmer is planting two types of trees, apple trees and pear trees. Each apple tree requires 15 square feet of space, and each pear tree requires 20 square feet of space. The farmer has a total of 600 square feet available for planting. The relationship between the number of apple trees () and pear trees () is given by . If the farmer decides to plant 18 pear trees, what is the maximum number of apple trees that can be planted?