Three Bay Area locales are among the best small cities to live in the country, a new analysis from Wallethub found. Los Altos, Saratoga, and Palo Alto all ranked in the 99th percentile when compared to 1,268 small cities across the country with populations between 25,000 and 100,000 people.

The report measured factors including affordability, economic health rank, education and health, quality of life, and safety. Los Altos especially ranked high for education and health. Residents there are very likely to have health insurance and a high school diploma or higher. All three peninsula cities scored well for “economic health,” based on population growth, income growth, unemployment rate, the share of population living below poverty line, and debt per median earnings.

Not surprisingly, the Bay Area cities ranked lower on the list when it came to affordability. Leawood, Kansas and Brentwood, Tennessee made the list’s top five for their low cost of living, while Princeton, New Jersey took the list’s top spot overall.