The Safari Restaurant is giving away gift bags. They have 24 magnets and 36 pencils. They want all the bags to be the same so that each bag has the same number of magnets and the same number of pencils. What is the greatest number of gift bags that the restaurant can make using all of the supplies?