Whether you get bogged down by brain fog or remain as smart as a whip until your ninth decade has a lot to do with the healthiness of your community. That’s because “sharpness” — present-day smarts as well as maintaining a healthy mind at low risk for dementia — depends on education level, eating and exercise habits, health conditions, and sociability, according to the latest brain-health studies.

Leading experts on cognition developed a formula to determine a city’s sharpness, and then Reader’s Digest analyzed the traits of 120 large cities. Here are the cities topped the list and the traits they exhibit that earned them the honor:

1. San Francisco, CA – Sharp trait: Farmer’s markets, which help ensure that residents fill up on plenty of brain-healthy foods.
2. Arlington, VA – Sharp trait: Education. Seven in 10 residents hold at least a bachelors degree, far above the national average.
3. Fremont, CA – Sharp traits: Low smoking rate and high creativity levels.
4. Seattle, WA – Sharp trait: Exercise, which increases blood flow to the brain.
5. Madison, WI – Sharp trait: Diabetes prevention.
6. Portland, OR – Sharp traits: Biking and seasonal eating.
7. Salt Lake City, UT – Sharp traits: Libraries with circulation rates nearly double the national average.
8. Scottsdale, AZ – Sharp trait: Parks, which increase good moods.
9. St. Paul, MN – Sharp trait: Community that foster stimulating conversations that fire up the brain’s frontal lobe.
10.  Asheville, NC – Sharp trait: Spirituality and volunteerism.