According to a new study, changing your diet could add years to your life.

It’s common knowledge that eating a diet rich in fruits and vegetables is good for your overall health, but did you know it can also help you live longer?

According to a new study published in the journal PLOS Medicine, modifying your diet can extend your life by up to 13 years.

According to the study’s authors, “understanding the relative health potential of different food groups could enable people to achieve achievable and significant health gains.”

Researchers from Norway used a model to see what would happen to a person’s life expectancy if they substituted a conventional Western diet—one high in red meat and processed foods—with an optimal diet high in fruits, vegetables, legumes, whole grains, and nuts.

The researchers built this model using data from the Global Burden of Sickness Study, a database that analyzes various causes of death, disease and injury, as well as risk factors, in 204 nations and territories around the world.

According to the study, a woman who started eating healthily at the age of 20 may add slightly over 10 years to her life expectancy, while a male of the same age could add 13.

This lifestyle modification doesn’t simply benefit young people; a woman starting the diet at the age of 60 might add eight years to her life expectancy, while a guy starting at the age of 60 could add nearly nine. Furthermore, dietary adjustments could add 3.5 years to the life expectancy of 80-year-old men and women.

More legumes, such as beans, peas, and lentils, as well as whole grains, walnuts, almonds, pecans, and pistachios, were found to have the greatest impact on longevity among the items included in the optimized diet. According to the study, eating less red and processed meat, such as bacon, sausage, and deli meats, is also linked to a longer life.

“Until now, research has demonstrated health benefits connected with specific food groups or diet patterns, but there has been less evidence on the health impact of other diet alterations,” says Lars Fadnes of the University of Bergen, who led the study. “This chasm has been filled by our modeling methods.”