We propose a quantum-enhanced iterative (with $K$ steps) measurement scheme based on an ensemble of $N$ two-level probes which asymptotically approaches the Heisenberg limit $delta_K propto R^{-K/(K+1)}$, $R$ the number of quantum resources. The protocol is inspired by Kitaevs phase estimation algorithm and involves only collective manipulation and measurement of the ensemble. The iterative procedure takes the shot-noise limited primary measurement with precision $delta_1propto N^{-1/2}$ to increasingly precise results $delta_Kpropto N^{-K/2}$. A straightforward implementation of the algorithm makes use of a two-component atomic cloud of Bosons in the precision measurement of a magnetic field.