Add counter for number of iterations