The effects of resonant magnetic perturbations (RMPs) and the magnetic drift on the loss and redistribution of passing ions are investigated numerically by the upgrade version of the orbit following code GYCAVA. The drift island structures of passing ion orbits induced by RMPs and the magnetic drift are consistent with the given toroidal and poloidal mode numbers of RMPs in the orbit simulations. The redistribution and loss of energetic and thermal passing ions with and without RMPs are numerically studied and compared with each other. The redistribution near the edge is due to the loss induced by RMPs and the magnetic drift. The extra loss of passing ions induced by RMPs is related to the drift island structure induced by RMPs and the magnetic drift and the stochasticity induced by overlap of magnetic islands. The loss of passing ions with n = 1 RMPs is larger than that with n = 4 RMPs for the same perturbation amplitude parameter, which is due to the fact that the magnetic islands produced by n = 1 RMPs are larger than those produced by n = 4 RMPs. The loss fraction of passing ions with n = 1 RMPs increases with the amplitude of RMPs and the radial profile parameter of the ion density. The pitch and energy scan for the loss of energetic passing ions with n = 1 RMPs is simulated. For counter-passing ions, the loss fraction of low-pitch ions is larger than that of high-pitch ions. The dependence of the loss of energetic ions with RMPs on energy is related to the pitch angle.