Gauge fields provide the fundamental interactions in the Standard Model of particle physics. Gauge field configurations with nontrivial topological windings are known to play crucial roles in many important phenomena, from matter-anti-matter asymmetry of todays universe to the permanent quark confinement. Their presence is however elusive for direct detection in experiments. Here we show that measurements of the chiral magnetic effect (CME) in heavy ion collisions can be used for counting the topological windings of the non-Abelian gauge fields in the Quantum Chromodynamics (QCD). To achieve this, we implemented a key ingredient, the stochastic dynamics of gauge field topological fluctuations, into a state-of-the-art framework for simulating the CME in these collisions. This tool has allowed us to quantitatively extract, for the first time, the initial topological windings $Q_w$ from the CME experimental data, revealing a universal scaling relation between $Q_w$ and the particle multiplicity produced in the corresponding collision events.