Proving $\frac{p-1}{2}!\equiv (-1)^t$ where $t$ is the number of integers which are not quadratic squares 
Prove that $\frac{p-1}{2}!\equiv (-1)^t$ where $t$ is the number of integers $0<a<\frac{p}{2}$ which are not quadratic squares $\pmod p$ ($p\equiv3\bmod4$) 

I don't know really from where to start (we know from wilson that $(p-1)!\equiv -1\pmod p$ but that won't help here as far as I see). The lecturer suggested lookigng at $p-n$ where $1\le n\le p-1$.   I'd be glad for any hint. 
 A: $$\left ( \left ( \frac{p-1}{2} \right )! \right )^2= 1^2 \cdot 2^2 \cdot 3^2 \cdots \left (\frac{p-1}{2} \right )^2=1 \cdot 2 \cdot 3 \cdots  \frac{p-1}{2}   \cdot 1 \cdot 2 \cdot 3 \cdots  \frac{p-1}{2} \\\equiv 1 \cdot 2 \cdot 3 \cdots  \frac{p-1}{2}  \cdot (-1) \cdot (p-1) \cdot (-1) \cdot (p-2) \cdots (-1) \cdot \frac{p+1}{2} \overset{Wilson}{ \equiv} \ \ (-1) (-1)^{\frac{p-1}{2}} \equiv (-1)^{\frac{p+1}{2}} \pmod p$$
$$p \mid \left ( \left ( \frac{p-1}{2} \right )! \right )^2-(-1)^{\frac{p+1}{2}} \Rightarrow p \mid  \left( \left ( \frac{p-1}{2} \right )!-(-1)^{\frac{p+1}{2}} \right ) \left( \left (\frac{p-1}{2} \right )!+(-1)^{\frac{p+1}{2}} \right )$$
As $p$ is a prime, $p \mid   \left( \left ( \frac{p-1}{2} \right )!-(-1)^{\frac{p+1}{2}} \right )$ OR  $p \mid \left( \left (\frac{p-1}{2} \right )!+(-1)^{\frac{p+1}{2}} \right )$
Therefore, $ \left(\frac{p-1}{2} \right )! \equiv (-1)^{\frac{p+1}{2}} \pmod p$ OR $ \left(\frac{p-1}{2} \right )! \equiv (-1)^{\frac{p+3}{2}} \pmod p$
Now,it remains to show that the number of integers $0<a<\frac{p}{2}$ which are not quadratic squares $\pmod p$ is either $\frac{p+1}{2}$ or $\frac{p+3}{2}$.
A: I believe that theorem only holds for $p \equiv 3 \pmod{4}$.
In fact for $p = 5$ then $((p-1)/2)! \equiv 2$ and for $p = 13$ the factorial yields $5$, not a power of $-1$.
Not let $p \equiv 3 \pmod{4}$.
$$(p-1)! \equiv \left( 1·2·\ldots ·\frac{p-1}{2}\right)\left( \frac{p+1}{2}\ldots (p-1)\right)$$
But $p-a \equiv (-1)a$ So:
$$(p-1)! \equiv \left( 1·2·\ldots ·\frac{p-1}{2}\right)\left( \left( p-\frac{p-1}{2}\right)\ldots (p-1)\right) \equiv \left( 1·2·\ldots ·\frac{p-1}{2}\right)^2(-1)^{\frac{p-1}{2}} \equiv \left(\frac{p-1}{2}!\right)^2(-1)^{\frac{p-1}{2}}$$
Since $(p-1)! \equiv -1$ then:
$$(-1)^{\frac{p+1}{2}} \equiv \left(\frac{p-1}{2}!\right)^2 \equiv \prod_{k=1}^{\frac{p-1}{2}}k^2$$
Now, $p\equiv 3 \pmod{4}$ thus $(-1)^\frac{p+1}{2} = 1$:
$$1 \equiv \left(\frac{p-1}{2}!\right)^2 \equiv \prod_{k=1}^{\frac{p-1}{2}}k^2$$
Note that since $a^2 \equiv (p-a)^2$ then $\left(\frac{p-1}{2}!\right)^2$ is the product of all quadratic residues $\text{mod } p$.
Let $G = \lbrace  k^2 \mod p \text{ such that }  k^2 \text{ mod } p < p/2 \rbrace$. i.e. $G$ is the set of the quadratic residues lower than $p/2$.
Note that $(p-1)/2 - \vert G\vert$ is the amount of quadratic non-residues lower than $p/2$.
But there are $(p-1)/2$ quadratic residues $\text{mod } p$ so $(p-1)/2 - \vert G\vert$ is also the amount of quadratic residues bigger than $p/2$.
Let $s = (p-1)/2 - \vert G\vert$
Let $r_k = \begin{cases} k^2 \mod p,&\text{if }   k^2 \in G
\\ -k^2 \mod p,&\text{if }   k^2 \not\in G 
\end{cases} 
$
So our product becomes:
$$\prod_{k=1}^{\frac{p-1}{2}}k^2 = (-1)^s\prod_{k=1}^{\frac{p-1}{2}}r_k$$
