Let $x$ and $y$ are integers such that $-2\le x\le3$ and $-8\le y\le4$
Find the minimum value of $f=x^2+y^2+x(1-y)+y(1-x)\tag{1}$
From $(1)$, I get $f=(x-y)^2+x+y$ and I don't know what I should do next.
I had tried to use differential of f then I get no critical point (the minimum is on the bound $x=-2,x=3,y=-8$ or $y=4$). I found the minimum on $x=-2$ but $y=-2.5$ that isn't integer, the equation f that holds on $x=-2$ is $(y+2.5)^2-4.25,$ So no conclusion for $x,y$ are integers or Can it conclude that $y=2,3$ minimize f ? (I think this solution is suitable for real numbers).
I had tried to substitute all the possible cases then I got the minimum is $-4$, when $(x,y)$=$(-2,-2)$, $(-2,-3)$.
All help would be appreciated.

Because $x$ and $y$ are integers, we have $$f(x,y)=(y-x)^2+(y-x)+2x=\left(y-x+\frac{1}{2}\right)^2+2x-\frac{1}{4}\geq \frac{1}{4}+2x-\frac{1}{4}=2x\geq-4\,.$$ Therefore, $f(x,y)\geq-4$. The equality holds iff $y-x+\frac{1}{2}=\pm\frac{1}{2}$ and $x=-2$, which leads to $(x,y)=(-2,-2)$ and $(x,y)=(-2,-3)$.
If $x$ and $y$ may take non-integral values (within the required ranges), then $$f(x,y)\geq 2x-\frac{1}{4}\geq -\frac{17}{4}\,.$$ The equality holds iff $y-x+\frac{1}{2}=0$ and $x=-2$, i.e., $(x,y)=\left(-2,-\frac{5}{2}\right)$.
For the maximum, we note that $-\frac{21}{2}\leq y-x+\frac{1}{2}\leq \frac{13}{2}$, so $$f(x,y)\leq \frac{441}{4}+2x-\frac{1}{4}= 110+2x\leq 116\,.$$ The equality holds if and only if $y-x+\frac{1}{2}=-\frac{21}{2}$ and $x=3$, which means $(x,y)=(3,-8)$.