To bring you the best content on our sites and applications, Meredith partners with third party advertisers to serve digital ads, including personalized digital ads. Those advertisers use tracking technologies to collect information about your activity on our sites and applications and across the Internet and your other apps and devices.

You always have the choice to experience our sites without personalized advertising based on your web browsing activity by visiting the DAA’s Consumer Choice page, the NAI's website, and/or the EU online choices page, from each of your browsers or devices. To avoid personalized advertising based on your mobile app activity, you can install the DAA’s AppChoices app here. You can find much more information about your privacy choices in our privacy policy. Even if you choose not to have your activity tracked by third parties for advertising services, you will still see non-personalized ads on our sites and applications.

By clicking continue below and using our sites or applications, you agree that we and our third party advertisers can:· transfer your data to the United States or other countries; and· process and share your data so that we and third parties may serve you with personalized ads, subject to your choices as described above and in our privacy policy.

If it sometimes feels like there is a drugstore at practically every intersection in the United States, some relief is on the way.

Walgreens Boots Alliancewba said on Wednesday it would close nearly 600 of the 1,932 Rite Aidrad stores it is buying in a $4.375 billion cash deal set to close in the spring of 2018. The company two years ago had planned to buy smaller rival Rite Aid in its 4,500-store entirety but in the face of anti-trust regulators balking in June, instead settled for a downsized deal announced in September. A few Walgreens stores are also being closed.

The locations being closed were chosen because of overlap with another Rite Aid or Walgreens location, executives said.

More from FORTUNE

“The vast majority being closed are within one mile of another drugstore that we own going forward,” Alexander Gourlay, WBA’s co-chief operating officer, told Wall Street analysts on a conference call to discuss its latest quarterly results. The closings will take about a year and half and begin soon after the deal closes. Walgreens expects to pay about $500 million in additional capital spending to convert the stores it is buying but keeping.

It’s easy to see why Walgreens wants to reduce overlap: comparable retail sales fell 2.1% in its most recent quarter, so it does not need more of its own stores competing with each other. Rival druggist CVS Healthcvs , with nearly 9,700 locations, is also struggling with declining comparable sales of front-of-store merchandise. Both chains’ prescriptions businesses in contrast are growing. After the deal closes, Walgreens will have roughly the same number of stores as CVS, up from 8,000 now.

WBA, which also operates stores in Europe under the Boots name, said sales at Walgreens’ U.S. pharmacies rose 12.6% in the fiscal fourth quarter ended Aug. 31, and the company filled 250.2 million prescriptions, up 9%. The company also said it expects 2018 adjusted earnings of $5.40 to $5.70 per share, better than analysts’ average estimate of $5.47, according to Thomson Reuters I/B/E/S. Revenue rose 5.3% to $30.15 billion, above Wall Street forecasts.

As for profit, it took a hit from the $325 million termination fee it had to pay Rite Aid for the aborted merger. But excluding that and other one-time expenses, WBA earned $1.31 per share, above the Street’s forecasts for $1.21, sending its shares up 3%. Last month, Rite Aid had blamed the merger drama for weak results.