  We consider the current-phase relation (CPR) in the Josephson junctions with
complex insulator-superconductor-ferromagnetic interlayers in the vicinity of
0-$\pi$ transition. We find a strong impact of the second harmonic on CPR of
the junctions. It is shown that the critical current can be kept constant in
the region of 0-pi transition, while the CPR transforms through multi-valued
hysteretic states depending on the relative values of tunnel transparency and
magnetic thickness. Moreover, CPR in the transition region has multiple
branches with distinct ground states.
