This paper synthesizes recent research from several disciplines, concerning the cognitive, social and biological origins of mathematical thinking. In order to put the emerging views into a coherent framework, Uri Leron distinguishes three levels of mathematics, each with its own thinking mechanism. First, the ability to do Rudimentary Arithmetic is hard-wired in the brain and is processed by a "number sense", just as colors are processed by a "color sense". Second, Informal Mathematics is processed by the same mechanisms that make up our everyday cognition, such as imagery, natural language, thought experiment, social cognition and metaphor. Third, there is some evidence that thinking at the level of Formal Mathematics may actually conflict with some of our mind's "natural" cognitive mechanisms.