Wells Fargo continues to slim down its national branch network even as rival J. P. Morgan Chase is set on a big expansion.

Earlier Tuesday, Wells said it struck an agreement with Flagstar Bank to sell 52 branches in the upper Midwest, including $2.3 billion in deposits. About 490 employees will also get job offers from Flagstar, which is based in Troy, Michigan.

It is part of a larger cull Wells Fargo announced in January, when it said it would cut more than 800 locations by 2020 to get its network down to 5,000. Last year, it closed 214 branches.

Wells executives have cited consumer preference for online and mobile banking as the reason to close or sell branches, but litigation costs have also risen related to investigations into sales practices in several business units.

Wells has also previously announced plans to cut $4 billion in annual expenses by the end of next year.

The branch sales include 33 in Indiana, 14 in Michigan, one in Ohio and four in Wisconsin.

Rival J. P. Morgan has a $20 billion, five-year plan to open 400 new branches in new locations, recently announcing a move into Washington, D.C.