We present inversions for the structure of Mars using the first Martian seismic record collected by the InSight lander. We identified and used arrival times of direct, multiples, and depth phases of body waves, for seventeen marsquakes to constrain the quake locations and the one-dimensional average interior structure of Mars. We found the marsquake hypocenters to be shallower than 40 km depth, most of them being located in the Cerberus Fossae graben system, which could be a source of marsquakes. Our results show a significant velocity jump between the upper and the lower part of the crust, interpreted as the transition between intrusive and extrusive rocks. The lower crust makes up a significant fraction of the crust, with seismic velocities compatible with those of mafic to ultramafic rocks. Additional constraints on the crustal thickness from previous seismic analyses, combined with modeling relying on gravity and topography measurements, yield constraints on the present-day thermochemical state of Mars and on its long-term history. Our most constrained inversion results indicate a present-day surface heat flux of 22±1 mW/m2, a relatively hot mantle (potential temperature: 1740±90 K) and a thick lithosphere (540±120 km), associated with a lithospheric thermal gradient of 1.9±0.3 K/km. These results are compatible with recent seismic studies using a reduced data set and different inversions approaches, confirming that Mars’ mantle was initially relatively cold (1780±50 K) compared to its present-day state, and that its crust contains 10-12 times more heat-producing elements than the primitive mantle.