We introduce an up–down coloring of a virtual-link (or classical-link) diagram. The colorabilities give a lower bound of the minimum number of Reidemeister moves of type II which are needed between two [Formula: see text]-component virtual-link (or classical-link) diagrams. By using the notion of a quandle cocycle invariant, we give a method to detect the necessity of Reidemeister moves of type II between two given virtual-knot (or classical-knot) diagrams. As an application, we show that for any virtual-knot diagram [Formula: see text], there exists a diagram [Formula: see text] representing the same virtual-knot such that any sequence of generalized Reidemeister moves between them includes at least one Reidemeister move of type II.