ModelBuilder provides two built-in system variables that can be used in iteration workflows. These two system variables contain the current iteration number and the current list index: %i% refers to the current list position in a list variable (the first position is zero), and %n% refers to the current model iteration (the first iteration is zero).
Using the %i% system variable with in-line variable substitution
For models that run a process on a list of inputs, each time the process runs, the output will have the same name as the output from the previous run of the process, and the previous output will be overwritten. To avoid overwriting previous outputs in successive iterations, append the name of the output with %i%, which will give each output a unique name that indicates its position in the list of inputs.
Using the %n% system variable with in-line variable substitution
%n% gives the current model iteration number and is used in an iterating model. In the example below, the For iterator is used to iterate a model four times. The output of the Buffer tool is used as feedback into the tool as input. The model iterates and creates a new output at each iteration. %n% is used in the output name of the Buffer tool to give the output of each iteration a new name.