For demographers and economists, 2020 is a big year.

That’s when 20% of the population of the world’s richest countries will be older than 65—a magic number because, starting in the mid-1900s, it’s the age when people stop working (though in many European countries people retire at 60), collect pensions, and consume lots of health care. But the date people should really worry about is 2040. That’s when the bulk of surviving baby boomers will pass age 85 and make up more than 4.5% of the rich world’s population. The world’s over-age-85 population is projected to more than quadruple by 2050.

Not only are people living longer, but they’re living better well into old age, which will make the significance of age 65 less and less relevant. A new report from the World Health Organization documents not only a surging life expectancy, but a significant improvement in quality of life (in terms of health) during retirement. Sixty-five is the new 58.

Retirement is a modern invention and there’s no reason to believe it won’t continue to evolve as the population changes. The disappearance of defined-benefit pensions means more people can and often have to work later into life. Between better health and not saving enough, more people will end up working longer and continue to add to the economy. The US government has already predicted its labor force will continue to grow as boomers work past age 65, and most developed countries are inching official retirement toward 70.

However, innovations in health care can only prolong the inevitable for so long. And as life expectancy increases, the ways in which people die will change.

Heart disease, cancer, and strokes continue to be leading causes of death for Americans. In 1999, one of those three caused 64% of deaths among those 65 and over. By 2014, however, that percentage fell to 53%. Meanwhile, degenerative diseases that impair cognition, particularly Alzheimer’s disease, have been on the rise. That’s the flip side of people living longer. According to the OECD, only 3% of people age 65 to 69 have dementia, but that spikes to 30% for 85 to 89 year olds. About half of women in France and Germany over age 90 live with dementia and 40% of American women. Alzheimer’s is the third most common cause of death among Americans older than 85. And it’s not just heart-wrenching for its victims and their loved ones; it has consequences for the economy.

The figure below is health-care spending, per capita, by age in America.

Clearly, caring for very old people is expensive. However, they only took up 9% of health-care spending in 2010 in the US. The biggest spender in Europe is Sweden, where long-term care takes up about 4% of GDP. But these numbers are low because there are so few people currently over age 85. That will change.

By 2050 the world’s population living with dementia is expected to nearly triple (some of the biggest increases coming from poor countries). And as a larger share of the population ages past 85 and develops dementia, more will need labor-intensive, long-term care. Much of the cost for that type of care now falls on the government in European countries with strong welfare systems and in the US through Medicaid, meaning it has the potential to be a large driver of entitlement costs. There’s not only the direct expense of paying for nursing homes, but also the hidden cost of family members caring for relatives and spending less time in the labor force.

Of course, all these projections are based on how long actuaries expect people to live. Historically they have under-estimated improvements in life expectancy, so we may have more 85-plus year olds than expected. Or, obesity and drug addiction might reverse trends and shorten life expectancy. The uncertainty makes it difficult to know how expensive entitlements turn out to be and how financial markets will behave. Unfortunately, if the future is like the past, it will be more than we bargained for.