As we bid farewell to yet another year of Olympic games, you’ve no doubt been inspired by the determination and sheer athleticism of all the competitors in Rio.

And though most athletes are on the young side — consider that Michael Phelps, the most decorated Olympian of all time, plans to retire at the ripe age of 31 — there are some athletes competing much later in life.

Oksana Chusovitina, a gymnast from Uzbekistan, competed in her seventh Olympics at the age of 41. She hasn’t yet decided whether she’ll retire or strive to wow us at the Tokyo Olympics in 2020.

These athletic outliers are defying the odds to prove that getting older doesn’t mean you can’t stay in excellent physical shape. 

In fact, staying active as you age will help keep you healthier and more mobile.

“It’s true that we slowly lose muscle mass as we get older,” said Geisinger sports medicine specialist Justin G. Tunis, M.D. “But research shows that those effects are more pronounced in people who don’t exercise, as opposed to those who do.”

From the time you’re born until roughly the age of 30, your muscles continue to grow bigger and stronger. But during your 30s, your muscle mass will begin to decrease slowly. If you don’t do anything to combat this decline and lead a sedentary lifestyle, the pace of decline will speed up.

But the best way to treat this slow loss of muscle mass is with exercise.

“Regular exercise can combat this muscle mass loss, as well as help you maintain a healthy weight and protect against other diseases,” said Dr. Tunis said.

Exercise can help you lower stress, fight heart disease, high blood pressure and cholesterol, and prevent arthritis and even dementia.

Though exercising as you age can help stave off diseases and keep you feeling good, there are still some things to be careful of — especially if you’re just starting to exercise again.

“Just as you would at any age, it’s critical to listen to your body as you exercise,” said Dr. Tunis.

If you’re new to working out or changing up your regimen, take it slow and work up to longer aerobic exercises or heavier weights over time. If you’re running, for example, follow the ten percent rule: don’t add on more than 10 percent of your distance at a time. This will give your body time to adjust to the longer distance you’re running.

If you’ve been active for a long time, you still need to be careful.

“As you age, injuries like tendonitis can become more common because tendons lose their elasticity,” said Dr. Tunis. “Osteoporosis can also weaken the bones and cause fractures, though this is more common in women than in men.”

Eating a healthy diet in addition to staying active can help prevent issues as you age.