  We consider a slow-fast Hamiltonian system with one fast angular variable (a
fast phase) whose frequency vanishes on some surface in the space of slow
variables (a resonant surface). Systems of such form appear in the study of
dynamics of charged particles in inhomogeneous magnetic field under influence
of a high-frequency electrostatic waves. Trajectories of the averaged over the
fast phase system cross the resonant surface. The fast phase makes $\sim \frac
{1}{\varepsilon}$ turns before arrival to the resonant surface ($\varepsilon$
is a small parameter of the problem). An asymptotic formula for the value of
the phase at the arrival to the resonance was derived earlier in the context of
study of charged particle dynamics on the basis of heuristic considerations
without any estimates of its accuracy. We provide a rigorous derivation of this
formula and prove that its accuracy is $O(\sqrt \varepsilon)$ (up to a
logarithmic correction). Numerics indicate that this estimate for the accuracy
is optimal.
