While genetics and exercise play a large role in your brain health and risk of developing dementia, diet is quite influential, too. There is no magical elixir that can cure or completely prevent dementia or Alzheimer’s disease, but scientists have been able to pinpoint certain nutrients that are associated with improved cognitive function or memory. Keeping your diet full of the foods that contain them, then, can help you protect your brain.

Cocoa Flavanols

Cocoa flavanols are found naturally in cocoa and can be beneficial to your brain health; they make dark chocolate healthier than regular chocolate, which has been washed out with milk and sugar. A 2014 study examined the impact of eating a high cocoa flavanol diet over the course of three months. The researchers focused primarily on the dentate gyrus (DG), a part of the hippocampal formation in the brain that, when it declines, is often associated with aging. Scientists believe this part of the brain is linked to memory loss. After eating a lot of cocoa flavanols, the researchers report that the participants experienced “enhanced DG function.”

Omega-3 Fatty Acids

Fish that are rich in omega-3 fatty acids, like salmon, mackerel, and tuna, are going to not only help your heart health, but they’ll also give you a boost in brainpower. According to a 2014 study, mice that were given supplements of omega-3 polyunsaturated fatty acid showed improved cognitive function while they aged — showing better object recognition memory, spatial and localized memory, and aversive response retention.

Nuts

Nuts contain omega-3 fatty acids like fish, so adding nuts to your diet in addition to fish will provide you with solid amounts. Walnuts, in particular, have been shown to fight memory loss. In one recent large-scale analysis, researchers found that a diet supplemented with walnuts — which are high in omega-3 fatty acids, vitamin E, folate, antioxidants, and melatonin — improved adults’ performances on a series of six cognitive tests.

Magnesium

Scientists believe that a magnesium deficiency may play a role in cognitive decline, brain aging, and ultimately, dementia. So taking magnesium supplements — or eating foods that contain magnesium, like chard, spinach, pumpkin seeds, yogurt, almonds, black beans, avocados, figs, dark chocolate, or bananas — can help you fight off the effects of the aging brain.

Blueberries

Blueberries are delicious, but they also help in boosting your memory. According to a 2010 study, blueberries were shown to have antioxidant and anti-inflammatory effects. They also contain anthocyanins, compounds that are associated with increased neuronal signaling in the brain’s memory areas. In the study, researchers found that participants who drank wild blueberry juice on a daily basis had improvements in paired associate learning and word list recall; they also found lower depressive symptoms and glucose levels.

Cruciferous Vegetables

According to the National Institute on Aging, eating a lot of fruits, vegetables, and whole grains can help stave off cognitive decline as well as other chronic diseases, like heart disease and type 2 diabetes. Green, leafy, cruciferous vegetables in particular (like broccoli and spinach) have been shown to reduce the rate of cognitive decline. The Mediterranean diet, in particular (vegetables, legumes, fruits, cereals, fish, olive oil, mild amounts of alcohol — as well as low consumption of saturated fats, dairy, meat, and poultry) has shown in studies to be beneficial for cognitive health compared to more “Western” diets that are high in fats, carbs, and meat.

Green Tea

Green tea is good for a lot of things — but it’s also going to help you protect your brain. In a recent study completed at the University of Basel, researchers found that green tea extract enhances your thinking process and working memory. Participants scored higher for working memory tasks after they received the green tea extract, and an MRI showed a boost in connectivity between the parietal and frontal cortex of the brain, meaning that green tea “might increase the short-term synaptic plasticity of the brain,” said Professor Stefan Borgwardt, an author of the study.