In 2017, there were 3,536,105 freight wagons in the world. This includes all kind of wagons of any form and shape (bulk and containerized) dedicated to transporting cargo of any kind, including solids and liquids.
If you want to know more, please go here. This data was sourced from the book Transportation and the Belt and Road Initiative, in which more data as well as the original primary sources of the data are available.