I have a table in PostGIS that has polygons overlapping each other. (see below an example of 4 overlapping polygons )
[![img_before](https://i.stack.imgur.com/kNTM0.png)](https://i.stack.imgur.com/kNTM0.png)

Someone could give me an idea, what PostGIS function I can use that give me single part polygons based on their intersection, like the following:
[![img_after](https://i.stack.imgur.com/O74xP.png)](https://i.stack.imgur.com/O74xP.png)

PS: Actually what I want in the end is the individual polygons with no overlap, but the count of polygons overlapping it (counting itself). For example, in the second figure, the count of the polygon 2, 8, 12, 13 will be, respectively, 1, 2, 3, 4