A bear market can be a scary time to invest in stocks. It's discouraging to see your investments show returns that are deep in the red. But if you're a long-term investor, those losses could turn into significant gains over the long haul. Billionaire investor Warren Buffett isn't discouraged by concerning economic outlooks and instead focuses on the quality of the underlying businesses.

Investors can learn a lot from his strategy and approach to investing, which can help put into perspective the terrific buying opportunity that exists in the markets today. Here's a closer look at why Buffett doesn't mind buying in a downturn.

Fear brings bargains

Investors have been panicking this year, beset with fears of inflation, a recession, a war in Ukraine, and the future of the global economy. The usually reliable S&P 500 has fallen more than 23% in value thus far in 2022, bringing many quality stocks down along with it.

Buffett has said in the past that "widespread fear is your friend as an investor because it serves up bargain purchases." Many stocks are now trading at significantly reduced valuations that can make them cheap buys for the long haul. He also believes, "Every decade or so, dark clouds will fill the economic skies, and they will briefly rain gold. When downpours of that sort occur, it's imperative that we rush outdoors carrying washtubs, not teaspoons."

Given the gloominess of the current market conditions, it definitely looks as though the dark clouds are here. And Buffett's advice is clear: Investors should be loading up on the bargains that exist in the markets today.

Which types of stocks should you target?

A good starting point for long-term investors to find deals is to eye stocks that aren't trading just near their 52-week lows but also at low earnings multiples.

One such example is pharmacy retailer Walgreens Boots Alliance (WBA -1.26%). Although it hasn't been a great buy over the past five years, having lost half of its value during that time, the business is working on becoming leaner and more focused on healthcare, which could make it a much better buy in the years ahead.

The company released fourth-quarter earnings earlier this month that beat analyst expectations on both the top and bottom lines. Full-year revenue of $132.7 billion for the period ended Aug. 31 proved to be resilient, coming in relatively unchanged from a year ago. The company is projecting its core business to grow between 8% and 10% for the current fiscal year.

Meanwhile, Walgreens has invested billions into primary care. By fiscal 2025, it projects sales from this relatively new healthcare segment will bring in between $11 billion and $12 billion. This past year, the business unit generated $1.8 billion in revenue for Walgreens.

Trading at just seven times earnings and barely above book value, Walgreens is a cheap stock that also offers a high dividend yield of 5.8% (the S&P 500 average is just 1.8%). Although it may seem like a risky buy right now, Walgreens has the potential to outperform the markets in the future given its low valuation and growth prospects in healthcare.

Plenty of other attractive stocks abound in the market today as well. The key is to look for great businesses at reasonable valuations.