How to calculate number of attempt Tag