Given $ n = r- p + 1,$ where $n,r,$ and $p$ are all positive integers and $1\le p \lt r \le n$. I'm trying to prove that $\lfloor \frac{r+p}2 \rfloor - p + 1 = \lceil\frac n2\rceil$. I tried first to examine the four cases that arise depending on whether each of p and r is odd or even, but I couldn't reach anything.
I also tried to prove it directly using some properties of the floor and ceiling functions:
$\lfloor \frac{r+p}2 \rfloor - p + 1 = \lfloor \frac{r+p-2p+2}2\rfloor = \lfloor \frac{r-p+2}2 \rfloor$.
And we know that $ \lceil \frac n2 \rceil = \lceil \frac{r-p+1}2 \rceil. $ Therefore, the only thing left to prove is that $\lfloor r-p+2 \rfloor = \lceil r-p+1 \rceil $.
I'm not seeing how to continue, perhaps I did something wrong on the way?