Cosmological tests based on cluster counts require accurate calibration of the space density of massive halos , but most calibrations to date have ignored complex gas physics associated with halo baryons . We explore the sensitivity of the halo mass function to baryon physics using two pairs of gas-dynamic simulations that are likely to bracket the true behavior . Each pair consists of a baseline model involving only gravity and shock heating , and a refined physics model aimed at reproducing the observed scaling of the hot , intracluster gas phase . One pair consists of billion-particle re-simulations of the original 500 \ > { h ^ { -1 } } \ > { Mpc } Millennium Simulation of Springel et al . ( 2005 ) , run with the SPH code Gadget-2 and using a refined physics treatment approximated by preheating ( PH ) at high redshift . The other pair are high-resolution simulations from the adaptive-mesh refinement code ART , for which the refined treatment includes cooling , star formation , and supernova feedback ( CSF ) . We find that , although the mass functions of the gravity-only ( GO ) treatments are consistent with the recent calibration of ( 36 ) , both pairs of simulations with refined baryon physics show significant deviations . Relative to the GO case , the masses of \sim 10 ^ { 14 } \ > { h ^ { -1 } } \ > { M _ { \sun } } halos in the PH and CSF treatments are shifted by averages of -15 \pm 1 percent and +12 \pm 5 percent , respectively . These mass shifts cause \sim 30 \% deviations in number density relative to the Tinker function , significantly larger than the 5 \% statistical uncertainty of that calibration .