There are currently 30 teams. Few teams have truly become defunct, because many of them just relocated. When the team goes away, another team fills its spot.
There were 16 teams in MLB in 1903, 8 in the American League and 8 in the National League. American League 1) Boston Americans (now Boston Red Sox) 2) Philadelphia Athletics (now Oakland Athletics)...
There were 18 teams in 1961.
The American League expanded to 10 teams for the 1961 season, while the National League remained at 8 teams, until expanding to 10 teams in 1962.