Exercise 'keeps the mind sharp' in over-50s, study finds