My 10-year-old son loves to play soccer. But he’s fairly new to the game and lately he’s been grappling with a tough truth that comes with the territory of every sport—sometimes you’re going to lose.

He started the year excited about playing goalie. Then he gave up four goals in one game, and ever since he hasn't been so sure that’s the position for him. This past weekend he played in his first tournament. His team lost two games out of three. Sunday night he was unusually quiet. His world didn’t look so bright.

As a stock market investor, you can probably relate. Of the many behavioral biases that plague investors, loss aversion may be the most problematic. It’s the fact that for most investors, the pain felt from losing money is much greater than the pleasure experienced when their portfolio is growing.

Perhaps that’s why so many people walked away from the market during the Great Recession. According to Gallup, before 2008, 65% of people owned stock—either directly or through mutual funds. Today, that figure is down to 52%.

Those who couldn’t handle the pain missed out on one of the strongest bull markets in history. Since bottoming out in March of 2009, the market nearly tripled in value by the end of 2015.

In order to win, you have to accept some losses along the way—and stay in the game.

In a recent article on his blog, A Wealth of Common Sense, Ben Carlson looked at 180 years of stock market data and concluded:

Losses are really the one constant across all cycles…Stocks don’t make new highs every single day, so most of the time you’re going to be underwater from your portfolio’s high water mark. This means there are plenty of chances to be in a state of regret when investing in stocks.

The greater the loss, the greater the pain.

After Jordan Spieth turned a five-shot lead halfway through the final round of this year’s Masters into a three-shot loss, a reporter asked, “So, when you have the perspective of some time, are you going to be pleased that you were right back in the thick of things one more time…or disappointed you weren’t able to get it across the finish line?” Without hesitating, Spieth said, “Pretty sure I’ll be disappointed with that one.”

Of course he will. Losing never feels good. But losing is something all successful athletes—and investors—have to accept. There’s no avoiding it. From time to time, you’re going to lose. It’s part of the price you pay for the opportunity to win.

On Monday morning, my son still wasn’t himself. But Monday night, after working out with his team, the sparkle was back. He was excited about getting stronger, getting better. And really, he just wanted to get back on the field again and play.

That’s a great sign. He’s experienced a new side of the game this year—the pain of losing. It’s starting to sink in that it’s part of the game. And that if he wants to experience the joy of winning, he’s going to have to accept some losses along the way. He doesn’t have to like it, but he’s going to have to make peace with it.

It’s a good lesson for investors as well.

How have losses you’ve experienced in the market shaped you as an investor?