Brains change with age, but mental decline is not inevitable. Maintaining brain function, and consequently avoiding cognitive impairments such as dementia, is a matter of taking care of yourself through the years with a number of healthy activities.

Exercise

Exercise is a great way to lower your risk of hypertension and diabetes, but it’s also great for the brain.

“Memory is just a tiny part of brain functioning, and there’s a lot you can do to protect your brain health,” Johns Hopkins Neurologist Barry Gordon, M.D., Ph.D., told John Hopkins Medicine. According to the doctor, exercise may help activate beneficial genes in the brain.

“A surprising amount of evidence points to this as the No. 1 thing you can do to improve brain health,” he added.

Education

Staying mentally active is another important step to ensuring your cognitive functions remain in tip-top shape. According to the Alzheimer’s Association, simply taking a class at a local college can lower your risk of dementia.

“Formal education in any stage of life will help reduce your risk of cognitive decline and dementia,” the association reported. “For example, take a class at a local college, community center or online.”

Sleep

Healthy sleep is paramount for brain health, making your sleep schedule a priority.

“Aim for seven to eight consecutive hours of sleep per night, not fragmented sleep of two- or three-hour increments,” Kelsey Kidd, C.N.P. told Mayo Clinic. “Consecutive sleep gives your brain the time to consolidate and store your memories effectively. Sleep apnea harms your brain’s health and could be why you may struggle to get consecutive hours of sleep. Talk with your health care team if you or a loved one suspects you have sleep apnea.”

Cholesterol

High levels of LDL, also known as bad cholesterol, are associated with an increased risk of dementia, according to Harvard Medical School. To lower your bad cholesterol, the school recommends exercise, dieting and weight control, and avoiding tobacco.