Here's a hint to get you started. An odd integer has the form 2k+1 for some integer k.
Let n be an odd integer that isn't divisible by 3. Then mod 24.
So I have n = 3x+1 and n = 3x+2.
So 24 | .
I'm stuck after this. Should I do the X and get n odd and then do the n^2 or?....
EDIT: I figured out that if I can get n^2 - 1 mod 3 and n^2 - 1 mod 8 then X is a divisor of n^2-1 where X is the least common multiple of 3 and 8. So then that would be 24. So I just need the mod 3 and mod 8 but I can't get them quite right.