California is a state in the Western United States. With over 39.3 million residents across a total area of approximately 163,696 square miles (423,970 km2), it is the most populous and the third-largest U.S. state by area. It is also the most populated subnational entity in North America and the 34th most populous in the world. The Greater Los Angeles area and the San Francisco Bay Area are the nation's second and fifth most populous urban regions respectively, with the former having more than 18.7 million residents and the latter having over 9.6 million. Sacramento is the state's capital, while Los Angeles is the most populous city in the state and the second most populous city in the country. Los Angeles County is the country's most populous, while San Bernardino County is the largest county by area in the country. San Francisco, which is both a city and county, is the second most densely populated major city in the country and the fifth most densely populated county in the country, behind four of New York City's five boroughs.