LOS ANGELES (CBSLA/AP) — California’s population is approaching 40 million after growing by nearly 300,000 people during the year ending July 1, 2017, state officials reported Thursday in their annual county-by-county population update.

That puts the state’s total population at 39.6 million, by far the largest in the country. In fact, California has more people than Canada, which has a population of 36.3 million.

READ MORE: One Crew Member Killed, Second Wounded After Alec Baldwin Discharges Prop Gun On Movie Set In New Mexico

California’s counties range in size from 10.3 million in Los Angeles, which is larger than most states, to tiny Alpine with just 1,141 people — nine fewer than a year ago.

Most of the population growth came from births, which outpaced deaths by 220,000. More people moved out of California than in from other U.S. states, but foreign immigration made up the difference. Total net migration added 80,000 people, according to the report by the Department of Finance.

The largest numeric increases were in the Southern California counties of Los Angeles, Riverside, San Diego, Orange and San Bernardino, which each grew by more than 20,000 people. The biggest percentage jumps were in the Sacramento suburbs, the Inland Empire outside Los Angeles and the Central Valley.

READ MORE: Alec Baldwin On Fatal Movie Set Shooting Of Director Of Photography Halyna Hutchins: ‘There Are No Words’

Thirteen counties shrank, most of them sparsely populated areas in far Northern California and the Sierra Nevada range. Marin County, which includes wealthy San Francisco suburbs north of the Golden Gate Bridge, lost 161 people.

Nine counties with more than 1 million people each comprise 70 percent of the state’s population. They include the cities and suburbs of Los Angeles, San Diego and Sacramento as well as Silicon Valley and the East Bay outside San Francisco.

With 880,000 people, San Francisco is the state’s 12th largest county.

Being the most populated state does, of course, come with problems, like the longest commutes in the country and the highest housing costs.

MORE NEWS: Actress Frances Fisher Posts Tribute To Halyna Hutchins, Crewmember Killed In Prop Gun Shooting On Film Set

(© Copyright 2017 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)