Our knowledge of the birth mass function of neutron stars and black holes is based on observations of binary systems but the binary evolution likely affects the final mass of the compact object. Gravitational microlensing allows us to detect and measure masses of isolated stellar remnants, which are nearly impossible to obtain with other techniques. Here, we analyze a sample of 4360 gravitational microlensing events detected during the third phase of the OGLE survey. We select a subsample of 87 long-timescale low-blending events. We estimate the masses of lensing objects by combining photometric data from OGLE and proper-motion information from OGLE and Gaia EDR3. We find 35 high-probability dark lenses - white dwarfs, neutron stars, and black holes - which we use to constrain the mass function of isolated stellar remnants. In the range 1-100 M_Sun, occupied by neutron stars and black holes, the remnant mass function is continuous and can be approximated as a power-law with a slope of $0.83^{+0.16}_{-0.18}$ with a tentative evidence against a broad gap between neutron stars and black holes. This slope is slightly flatter than the slope of the mass function of black holes detected by gravitational wave detectors LIGO and Virgo, although both values are consistent with each other within the quoted error bars. The measured slope of the remnant mass function agrees with predictions of some population synthesis models of black hole formation.