I’m not getting the approach of the author mainly the last part in which he counts the number of Consecutive Subsequences.

Editorial : https://www.hackerrank.com/challenges/consecutive-subsequences/editorial

More specifically explain me this part,

```
long long res = 0;
for(int r = 0; r < k; r ++)
res += (cnt[r]*(cnt[r]-1)/2);
cout << res << endl;
```