For which n is 1^2 + 2^2 + ... + (n-1)^2 ≡ 0 mod n true?

For which n ≥ 2 is the following true; 1^2 + 2^2 + ... + (n-1)^2 ≡ 0 mod n

I've tried some numbers and found that it works for 5 but I'm not exactly sure why that is.

I'm aware of that 1^2 + 2^2 + ... + (n-1)^2 is the sum of every element in complete residue system for n multiplicative by itself and that I need to find out when there's a factor n in this sum but I'm honestly pretty stuck. Can anyone perhaps help me out?

Re: For which n is 1^2 + 2^2 + ... + (n-1)^2 ≡ 0 mod n true?