So this is my query to count items in given folder:
And it gives me count of all elements but how I can count only folders inside
You can examine the returned XML to find related querries for your request...
There is no nice way to just pull the folder count, but you can use the /folders to retrieve all folders below the current node.
See this line from the returned XML for your query:
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/teams/TeamsiteTestHeiko/Shared%20Documents')/Folders" /> <title />
Calling that on my root DocLib with 2 folders returns the correct answer of 3 folders since you will also be getting the Forms folder in the root level.
Hope that helps