The trick to staving off memory problems and cognitive decline in old age could be as simple as walking more, new research suggests.

In a decades-long study of the association between physical activity and cognitive function, researchers at the University of Pittsburgh discovered a link between walking more and better mental function in old age. The research group began following the physical and cognitive activities of 300 older adults, with an average age of 78, in 1989. After charting the group’s walking habits for nine years, each participant was given a brain scan. All were declared to be in good cognitive health. Four years later, roughly one-third of the group members had developed dementia, according to the study.

After comparing brain scans, walking patterns and cognitive function, researchers discovered a correlation between the distance a person walks and the preservation of the gray matter of the brain. Specifically, areas associated with cognitive function were better preserved among individuals who walked roughly six to nine miles per week, according to researchers. Despite the promising findings, researchers note that it is, so far, just an association. The study does not prove that walking causes the preservation of cognitive function—only that those who walk appear to have better preserved mental acuity. The study appears online in the Oct. 13 edition of the journal Neurology.