If you’re looking to get rich, chances are, you’re better off heading to Silicon Valley than Wall Street, according to a new study. Of the 21 most populous U.S. cities ranked by savable income, debt burden, the economic value of residents’ skills, homeownership rates and access to financial services, San Francisco was number one, followed by Minneapolis, Washington, D.C., St. Louis and Detroit, consumer financial services company Bankrate found.

Many of the least wealthy cities in the Bankrate study were also the most unequal. As for where accumulating wealth is hardest, the study cited Riverside/San Bernardino, California, a metropolitan area just east of Los Angeles, as the most difficult, followed by Miami, Tampa, Atlanta and Houston.

“When people think of wealth, most of the time they think of Warren Buffett, or Ferraris, but wealth is much more mundane than that,” Bankrate analyst Claes Bell told International Business Times, citing retirement and pension funds as somewhat less salient wealth indicators. “People pay a lot of attention to their income and how much they made in the last year, but not so much to their net wealth.”

Minneapolis, for example, was a relatively lower-income city. But its residents had one of the study’s lowest debt burdens, one of the country’s lowest unemployment rates and the study’s highest score for access to financial services. Detroit’s booming housing market was the main reason it made the top five: the Rust Belt city had the highest homeownership rate of all cities in the study, according to Bankrate.

While Atlanta, which, like most of the South, enjoys a lower cost of living, stagnant incomes kept residents from capitalizing on the benefits, Bell said. Houston, once a booming oil city, suffered from the effects of falling crude prices.

For some urban areas on the list, however, the samples of city residents may be self-selecting. People in San Francisco or Washington, D.C., on average, put away more money than residents of any of the other metropolitan areas studied, according to Bankrate. That’s because—along with San Jose, another Silicon Valley hot spot—they boast the highest median annual salaries of major U.S. cities, as Business Insider pointed out. Professionals in the highest-paying and fastest-growing industries, such as online marketplaces and search engines, software and education and health services, will migrate to cities where those jobs are most prevalent.

But while techies flocking to Silicon Valley may benefit from more-than-comfortable salaries, not everyone can simply head to San Francisco and get rich. In fact, depending on your skill set, you may get poorer, or simply driven out by high rent. The tech industry has a tendency to reward high skills rather than mid-level or blue-collar ones, leading to “a hollowing out of labor markets” and an exacerbation of income inequality in places like Silicon Valley, according to a report from the World Bank. The organization released its study just a month after Bay Area protesters blocked the paths of large, luxury buses offered to employees of Google, Facebook, Apple and Yahoo by company leadership. Meanwhile, median rent in the region has skyrocketed, making San Francisco the country’s most expensive urban area in terms of rent prices—and forcing lower-income earners out in the process.

“San Francisco is an unusual case,” Bell said, adding that the Silicon Valley urban center stood out because of its relatively low homeownership score.