It sounds like you have an arbitrary number of circles and you want to know how many are colliding at some given point? If that is the case then you do a circle collision test for all of the circles in a for loop and increment a counter every time there is a collision. For example (in pseudo code):
int countCollisions = 0;
for (int i = 0; i < numBalls; i++) {
for (int j = 0; j < numBalls; j++) {
if (ball i and ball j collide && i != j) {
// whatever you want to happen when they collide
countCollisions++;
}
}
}
println(countCollisions);