Mammals evolved from synapsid ancestors during the Mesozoic era. The earliest mammals had specialized teeth, small bodies, and various skeletal adaptations including differentiated dentition. The three main modern mammal groups are monotremes, marsupials, and placentals. Key mammalian adaptations include hair, three middle ear bones derived from jaw bones, and a four-chambered heart and diaphragm. Mammals exhibit diverse diets, habitats, and locomotion across nearly 4000 living species.