# How can I prove this?

I was reading a book on econometrics and I found this algebraic transformation and I don't know how I can get there.I would appreciate some help.
$$\sum_{i=1}^n (X_i-\bar{X})\cdot (Y_i-\bar{Y})=\sum_{i=1}^n (X_i-\bar{X})\cdot Y_i=\sum_{i=1}^n X_i\cdot (Y_i-\bar{Y})$$

$$\sum_{i=1}^n(X_i -\bar{X})(Y_i -\bar{Y}) =\sum_{i=1}^n(X_i -\bar{X})(Y_i) -\sum_{i=1}^n(X_i -\bar{X})\bar{Y}$$
The key is that $$\bar{Y}$$ is a constant, so we can bring it in front of the summation.
$$=\sum_{i=1}^n(X_i -\bar{X})(Y_i) -\bar{Y}\sum_{i=1}^n(X_i -\bar{X})$$
Then apply, $$\sum_{i=1}^n(X_i -\bar{X})=0$$.