Add precount to for loop

Adding precount to for loop