David purchased some cookies at the cost of 5 for $4 and sold them at 4 for $5. David made a profit of $180 in total. How many cookies did David purchase to make that much money?