Japan is shrinking. Fast.

The health ministry recently announced that only 946,060 babies were born in Japan in 2017, the fewest births since official statistics began in 1899. At the same time, 1,340,433 Japanese people died last year. This means that the non-immigrant population declined by nearly 400,000 people.

It’s an astonishing shift. The Japanese population grew steadily throughout the 20th century, from around 44 million in 1900 to 128 million in 2000. The gains were primarily due to increased life expectancy, but also buoyed by families that typically had at least two children. But beginning in the late 1970s, birth rates crashed. While the average Japanese woman had 2.1 kids in the 1970s, today, they only have about 1.4—far lower than in comparably wealthy countries like the US and Sweden.

Today, Japan is a land of aging baby boomers and young adults who don’t want to have kids. By median age, Japan is the oldest large country in the world. More than half of its population is over the age of 46. By comparison, in Nigeria, just over a tenth of the population is over that age.

The oldest countries by median age, 2015

Rank Country Median age 1 Japan 46.3 2 Italy 45.9 3 Germany 45.9 4 Portugal 43.9 5 Martinique 43.7 6 Bulgaria 43.5 7 Greece 43.3 8 Austria 43.2 9 Hong Kong 43.2 10 Spain 43.2

Demographers forecast a steep population decline for Japan this century. The Japanese Statistics Bureau (pdf) estimates that the Japanese population will fall to just over 100 million by 2050, from around 127 million today. The United Nations estimates that Japan’s population will decline by a third from current levels, to 85 million, by 2100. That would make it the fastest-contracting country among the world’s 30 most populous nations.

How low can it go? At the pace of decline projected by the UN, and assuming no change in migration or fertility rates, the Japanese population would fall to 8.5 million by 2300. By 2800, it would be less than 2 million. The laws of math mean it would decline very slowly from there.

The decline isn’t inevitable if Japanese women choose to have more children, or the country decides to take in more immigrants. The government’s clear preference is for the former.

Beginning in the mid-1990s, Japan’s government enacted a number of programs to make having kids more appealing for young adults. These were supposed to reduce the costs of childcare and force companies to adopt more parent-friendly policies. The plan doesn’t seem to have worked—though perhaps it stopped the decline from getting even worse.

To avoid massive population declines, Japan will almost certainly have to turn to immigrants. The government seems to reluctantly acknowledge this. The number of foreign workers skyrocketed over the past decade, from 300,000 in 2007 to nearly 1.3 million in 2017. Yet few of these workers are offered permanent resident status, and to discourage them from staying most are not allowed to bring over their families.

Yet to truly solve Japan’s population problem, it will need to embrace immigrants in a way it never has before. If it doesn’t, some day there may be barely any Japanese left at all.