Will right to buy discount count as deposit?

Yes. The mortgage lender who offers you the mortgage for the Right to Buy will give you a much cheaper interest rate because you will use the full deposit as the deposit which give you cheaper interest rates on the mortgage.
Just note that not all mortgage lenders offer Right to Buy mortgages.