Halloween is probably the first time any young child thinks about population density.

After all, getting the most candy in the least amount of time on Oct. 31 requires that you go where the people are packed in the tightest. But density isn’t the only factor that makes for a good Halloween experience if you asks the economists at real-estate data firm Zillow.

Using home values, single-family home density, crime rates, and the share of the population under 10 years old, they compiled an index to determine the best cities in the U.S. for candy canvassing. “This data combines to give us the safest cities to trick or treat, where trick-or-treaters can get the best candy, in the least amount of time,” Zillow says.

The density of single-family homes in Philadelphia rocketed the City of Brotherly Love to the top of the list, followed by San Jose, San Francisco, Milwaukee, and Los Angeles. Check out the rest of the list below.

  1. Philadelphia
  2. San Jose, Calif.
  3. San Francisco
  4. Milwaukee
  5. Los Angeles
  6. Phoenix
  7. Denver
  8. Portland, Ore.
  9. Seattle
  10. Columbus, Ohio
  11. Las Vegas
  12. Baltimore
  13. Dallas
  14. San Diego
  15. Charlotte, N.C.
  16. Austin, Texas
  17. Albuquerque, N.M.
  18. Chicago
  19. Nashville, Tenn.
  20. Washington, DC

You can also head over to Zillow’s site for the best neighborhoods for trick-or-treating in the top five cities.