Walking can lower your risk of having a heart attack, as any doctor will tell you. Now scientists have found out exactly how many steps it takes to keep you ticker healthy.

Even people who are at risk for diabetes can cut their risk for heart-related events like a heart attack or stroke by 8%.

In new research published in the journal Lancet, scientists report that among people with early signs of pre-diabetes, taking an extra 2,000 steps a day–the equivalent of 20 minutes of moderate-paced walking–helped them lower their chances of heart problems.

The research team looked at data from 9,306 adults from 40 countries participating in a trial called NAVIGATOR. All of the volunteers were assigned to a program to lose weight and exercise 150 minutes a week. They were given pedometers that they wore for a week at the beginning of the study, and again a year later.

Using statistical modeling, the researchers studied the association between the number of steps the participants took on average and their relative risk for heart events in that year, accounting for potentially confounding factors that could influence heart disease rates such as diet and the participants’ previous history of heart issues.

Two thousand steps seemed to be the magic number. Even before the study began, for every 2,000 steps a day one participant tended to walk on average compared to another, he enjoyed a 10% lower rate of heart problems by the end of the year. During the study year, there was an additional 8% lower risk of heart disease for every 2,000 steps walked a day. Here’s how the researchers explained the additive effect of walking:

If subject A took 4000 steps per day at the start of the study and did not change their activity levels over the next 12 months, and subject B took 6000 steps per day at the start of the study and increased their activity levels to 8000 steps per day over the next 12 months, by the end of the study (other things being equal) subject B would have an 18% lower risk of cardiovascular disease.

That should be encouraging news to those who have added exercise to their daily routine. You don’t have to take your doctor’s word for it — now there’s pretty convincing data on exactly how much walking it takes to avoid heart disease.