How to add document statistics variables to text in Writer?

I would like to output numbers of images, tables and other objects used in document in text somehow like this:

This document has 10 images, 2 tables, etc.

Of course, I want it to automatically count said objects in document on Refresh all.

Statistics page tells taht it is somehow possible to use statistic values as variables in formulas, but there are no instructions on how to do it.

Is it even possible? If so, how to do it?

Try with Insert → Field → More Fields → Document tab, under Type select Statistics and then pick what you need. You may need to update the fields every now and then by pressing F9 (Tools → Update → Fields).