Also serialize results in counting mode (prints the count in the output file)