It’s no surprise when someone adopts healthier eating habits when they’re trying to slim down and look their best for summer. However, rarely do we hear about someone eating healthier in an effort to improve their cognitive skills. A recent study published in the American Academy of Neurology’s journal Neurology has found that adhering to a healthy diet can lower a person’s risk for suffering a decline in memory and thinking as they get older.

“The difference in our study is we didn’t prescribe a particular diet or explore for a particular diet pattern,” Smyth told CNN. “We just wanted to look at a diverse cohort of people all around the world and analyze what their risk for cognitive decline would be if they consumed what most organizations would consider a ‘healthy diet.’”

Smyth and his colleagues monitored the eating habits of 27,860 men and women from 40 different countries. Participants received grades based on reports indicating the amount of food they consumed from both healthy and unhealthy categories. Researchers also tested each participant’s memory and thinking skills at baseline, two years, and five years after the start of the study.

By the end of the study, 4,699 men and women experienced a decline in their memory and thinking skills. After accounting for potential related factors, such as physical activity, high blood pressure, and a history of cancer, the research team found that people adhering to the healthiest diets based on a maximum scoring grade of 30 were 24 percent less likely to experience cognitive declines compared to people with the unhealthiest diets.

“Adoption of a healthy diet probably begins early in life, and a healthy diet might also go along with adoption of other healthy behaviors,” Dr. Andrew Smyth, lead author of the study and nephrologist at McMaster University in Ontario, Canada, said in a statement.

According to Harvard Medical School, the effect an unhealthy diet has on our brain is remarkably similar to the effect it has on our heart. A diet high in saturated fat and trans fats raises blood levels of low-density lipoprotein (LDL), or “bad” cholesterol, which, over time builds up, resulting in damaged arteries. That same process can lead to the formation of beta-amyloid plaques in the brain. Increased production of these stick protein clusters is often considered a warning sign for Alzheimer’s disease.

Source: Dehghan M, O’Donnell M, Smyth A, et al. Healthy eating and reduced risk of cognitive decline. Neurology. 2015.