  We predict anomalous atomic-scale 0-pi transitions in a Josephson junction
with a ferromagnetic-insulator (FI) barrier. The ground state of such junction
alternates between 0- and pi-states when thickness of FI is increasing by a
single atomic layer. We find that the mechanism of the 0-pi transition can be
attributed to thickness-dependent phase-shifts between the wave numbers of
electrons and holes in FI. Based on these results, we show that stable pi-state
can be realized in junctions based on high-Tc superconductors with
La$_2$BaCuO$_5$ barrier.
