Delia is bagging 24 onion bagels and 16 plain bagels for her bakery customers. Each bag will hold only 1 type of bagel. Each bag will hold the same number of bagels. What is the greatest number of bagels she can put in each bag?