Pittsburgh ranks as the best U.S. metropolitan area to which to retire, according to a report released Monday by Bankrate. The Riverside/San Bernardino, CA, metro area was ranked last.

Bankrate examined 50 metro areas with an eye toward several factors, including weather, cost of living, crime rate, healthcare quality and affordability, taxes, senior well-being, the “friend factor” (the percentage of population aged 65 or more years), cultural vitality and public transportation. Pittsburgh ranked high based on its “very low” crime rate, “very low” cost of living and “great” friend factor.

Boston (No. 2), Los Angeles, Denver and Providence, RI, rounded out the top five cities.

The other cities ranking at the bottom in addition to Riverside/San Bernardino, CA, were Memphis, TN (49th); Louisville, KY; Buffalo, NY; and Indianapolis.

Cost of living information came from the Council for Community and Economic Research, crime data from the FBI, well-being rankings from the Gallup-Healthways Well-Being Index, healthcare data from the Agency for Healthcare Quality and Research, tax information from the Tax Foundation and weather information from the National Oceanic and Atmospheric Administration. Other data sources included the United Health Foundation, Healthview Services, America’s Health Rankings from the United Health Foundation, the Creative Vitality Suite, the Economic Census, the American Community Survey and the Bureau of Transportation Statistics.

See the whole list of cities and how they rated in each category here.