Use case

Return the number of times that the issue has been changed to the current status.

Expression

Create and configure a Smart field using this expression in Jira expression mode:

issue.changelogs.filter(changelog => changelog.items.some(item => item.fieldId == 'status' && item.toString == issue?.status?.name)).length

If it is only necessary to display the number of times that the issue has been in a specific status, replace issue?.status?.name with the name of the status between brackets, e.g. 'Rejected'.