Getting too much—or too little—can worsen cognitive and mental health.