People who exercise just once a month at any age can improve their cognitive skills and reduce the chances of getting dementia, a new study has found.
And so for anyone who has never done much physical activity it is never too late to get started, according to scientists at the University College London.
While it was known that exercise lowers the risk of dementia, it was not understood if there was a certain age by which this needed to start.
But the new findings suggest that even taking up exercise in your 60s is better than doing nothing at all for improving cognitive function.
The study examined data from 1,417 people (53% women) who filled in surveys about how much exercise they did.
The surveys were carried out five times throughout adulthood, when people were aged 36, 43, 53, 60-64 and 69.
While the question changed slightly for each assessment, generally people were asked: "In the last four weeks, in your spare time, have you taken part in any sports or vigorous leisure activities or done any exercises, things like badminton, swimming, conditioning exercises, yoga, press-ups, dancing, football, mountain climbing, jogging or brisk walks for 30 minutes or more?"
If people said yes, they were asked how often per month they did these activities.
People were then categorised as either not being active (no physical activity in a month), moderately active (once to four times per month) and most active (five or more times per month).
Cognitive tests, plus those looking at processing speed and memory, were carried out once people hit the age of 69.
The study found that people who were physically active at least one to four times a month in all five separate surveys performed the best on the tests.
This effect was bigger than for people who exercised frequently (more than five times a month) during at least one survey period, but who did not necessarily keep this up across multiple stages of life.
The authors concluded: "Being physically active at all time points in adulthood was associated with higher cognitive performance and verbal memory scores at age 69.
"Notably, the effect sizes were similar across all adult ages, and for those who were either moderately or most physically active, suggesting that being physically active at any time in adulthood, even if participating as little as once per month, is linked with higher cognition.
"However, most effects were observed in those maintaining physical activity across adulthood."
Lead author, Dr Sarah-Naomi James, added: "Our study suggests that engaging in any leisure-time physical activity, at any point in adult life, has a positive effect on cognition. This seems to be the case even at light levels of activity, between once to four times a month.
"What's more, people who have never been active before, and then start to be active in their 60s, also appear to have better cognitive function than those who were never active.
"The greatest cognitive effect was seen for those who stayed physically active throughout their life. The effect is accumulative, so the longer an individual is active, the more likely they are to have higher later-life cognitive function."
In the study, people took several cognitive tests aged 69, including the Addenbrooke's Cognitive Examination, which is used to screen people for cognitive impairment.
People also did a word learning test and a visual processing speed test, where they were asked to cross out all instances of a particular letter in a page of text.
Some 11% of people in the study were exercising at all five time points in adulthood, 17% were active at one, 20% were active at two and three, 17% were active at four and 15% at all five.
The study, published in the Journal of Neurology, Neurosurgery and Psychiatry, found that some of the link between exercise and brain health was explained by education, childhood attainment and socio-economic background, though the effect remained significant even when these were taken into account.
According to the NHS website, while there is no certain way to prevent all types of dementia, exercise, eating a healthy, balanced diet, maintaining a healthy weight, keeping blood pressure under control and stopping smoking can help.
Dr Susan Mitchell, head of policy at Alzheimer's Research UK, said: "This large study, which ran over three decades and which was co-funded by Alzheimer's Research UK, shows that it's never too late to start getting active, and how important it is to try and maintain this throughout our lifetime.
"Crucially it provides strong evidence that the more physically active we are, the greater the benefits are for our brain health."