Particle number projection in the macroscopic-microscopic approach