How to get the number of particles on when index in niagara using grid2D?

Hi every one , I am a recent contact with niagara and I had already implemented the ‘physarum’ effect with niagara
this : [UE] [Niagara] Physarum - YouTube
and would like to use niagara to implement a 2D gravity effect, like this Realtime 2D Gravity Simulation - YouTube
I need to get the current number of particles on grid unity and use the obtained value as mass to calculate the gravitational force.