Measurements of the low masses for the pulsar PSR J0737-3039B, for the companion of PSR J1756-2251 and for the companion of PSR J0453+1559 on the one hand and of the high masses for the pulsars PSR J1614-2230 and PSR J0348-0432 on the other demonstrate the existence of compact stars with masses in a broad range from 1.2 to 2 Msun. We show that for realistic stellar matter EoS it is possible to explain the whole set of cooling data within "nuclear medium cooling" scenario for compact stars by a variation of the star masses. We select appropriate proton gap profiles from those exploited in the literature and allow for a variation of the effective pion gap controlling the efficiency of the medium modified Urca process. Using the set of existing observational temperature-age data for neutron stars one can also extract their possible mass distribution from the cooling model, because for each of observed compact object its mass can be predicted from the model. Such analyses has been performed for a particular EoS - DD2 model and shown that indeed the interval of masses from 1.2 to 2 Msun should be equally populated.