The authors consider a transitory demographic shock that affects negatively the financing of retirement pensions-that is, workers either would have to pay more or retirees would receive less. In contrast to the existing literature, the authors endogenously determine optimal policies rather than explore the implications of exogenous parametric responses. Their approach identifies optimal strategies of the Social Security Administration to guarantee the financial sustainability of existing retirement pensions in a Pareto-improving way. Hence, no cohort will pay the cost of the demographic shock. The authors find that the optimal strategy is based on the following ingredients: elimination of compulsory retirement, a change in the structure of labor income taxation, and a temporary increase in the level of government debt.