Use Gauss Lemma (Number theory) to calculate the Legendre Symbol .

I know how to use Gauss Lemma. However we use the book: Ireland and Rosen. They define Gauss Lemma as:

. They say: Let be the least residue of , where is positive. As ranges between 1 and , n is the number of minus signs that occur in this way. I don't understand how to use this form of Gauss's Lemma