New statistical distributions for group counting in Bernoulli and Poisson processes