The United States occupation of Nicaragua from 1912 to 1933 was part of the Banana Wars, when the US military forcefully intervened in various Latin American countries from 1898 to 1934. The formal occupation began in 1912, even though there were various other assaults by the U.S. in Nicaragua throughout this period. American military interventions in Nicaragua were designed to stop any other nation except the United States of America from building a Nicaraguan Canal. Nicaragua assumed a quasi-protectorate status under the 1916 Bryan-Chamorro Treaty. But with the onset of the Great Depression and Augusto C. Sandino's Nicaraguan guerrilla troops fighting back against U.S. troops, it became too costly for the U.S. government and a withdrawal was ordered in 1933.
Question: How many years did the United States occupation of Nicaragua last?
Answer: 21