Visiting friends, going to parties, and being social may help keep your brain healthy and prevent or delay dementia in old age.