Johann baked 24 cookies for a picnic with his friends. Of the 10 friends he invited, 7 were able to attend the picnic. If Johann gave each of his friends the same number of cookies and had 3 cookies left for himself, how many did each friend get?