Goodness-of-fit test for count distributions with finite second moment