<i>Context. <i/>The light curves observed from X-ray pulsars and magnetars reflect the radiation emission pattern, the geometry of the magnetic field, and the neutron star compactness. <i>Aims. <i/>We study the statistics of X-ray pulse profiles in order to constrain the neutron star compactness and the magnetic field geometry.<i>Methods. <i/>We collect the data for 124 X-ray pulsars, which are mainly in high-mass X-ray binary systems, and classify their pulse profiles according to the number of observed peaks seen during one spin period, dividing them into two classes, single- and double-peaked. We find that the pulsars are distributed about equally between both groups. We also compute the probabilities predicted by the theoretical models of two antipodal point-like spots that emit radiation according to the pencil-like emission patterns. These are then compared to the observed fraction of pulsars in the two classes. <i>Results. <i/>Assuming a blackbody emission pattern, it is possible to constrain the neutron star compactness if the magnetic dipole has arbitrary inclinations to the pulsar rotational axis. More realistic pencil-beam patterns predict that 79% of the pulsars are double-peaked independently of their compactness. The theoretical predictions can be made consistent with the data if the magnetic dipole inclination to the rotational axis has an upper limit of 40° <i>±<i/> 4°. We also discuss the effect of limited sensitivity of the X-ray instruments to detect weak pulses, which lowers the number of detected double-peaked profiles and makes the theoretical predictions to be consistent with the data even if the magnetic dipole does have random inclinations. This shows that the statistics of pulse profiles does not allow us to constrain the neutron star compactness. In contrast to the previous claims by Bulik et al. (2003, A&A, 404, 1023), the data also do not require the magnetic inclination to be confined in a narrow interval.