Counting statistics of non-markovian quantum stochastic processes