If p is an odd prime then (p-1)! = -1 mod p
Proof: We will always be working modulo p. Note that x2 = 1 has exactly two unique solutions (this is straightforward but not as trivial as it would appear at first glance). Observe that for a fixed value of a, ax = 1 has a unique solution (modulo p) in x (again this is elementary but maybe not as trivial as it seems at first glance), so if we run a through 2, 3, 4,...,p-2, we can pair each item with another unique residue x which is not congruent to a, such that ax = 1, hence we have that 2.3.4...(p-2) = 1 which means that 1.2.3.4...(p-2)(p-1) = (p-1)! = p-1 = -1 mod p.