Create a table with metric values and amount of related instances

Hi,

The idea is to show a table with information about bunch of servers that are counted by metric values.
e.g.
Memory - Servers
1Gb - 2
2GB - 10
4GB - 4

Can such result be get by any PromQL formula?