You can display the number of rows in a set of detail data (data retrieved using a report or query) by creating a special merged field, RowCount:DatasetName.

Syntax{{RowCount:DatasetName}}
ValuesDatasetName is the name of the dataset from the Template Builder window.
Usage{{RowCount:Contacts}}

If the Contacts dataset has 10 rows of data, the number 10 appears in place of this field.