# HackerEarth Gotta catch 'em all! problem solution

In this HackerEarth Gotta catch 'em all! problem solution Little Arihant has always wanted to be the best Pokemon trainer in this world. And he thinks he has achieved his goal, so he wants to quickly go and meet Professor Oak and verify this fact. But like all Pokemon trainers, he has a weird habit, too. He catches Pokemons which can go through evolution to become a better one. After roaming in the Pokeworld for days, he has finally managed to catch k such Pokemons.

The way he can make a Pokemon go through evolution is NOT by making them fight battles, but by using an evolution stone. Since he has k Pokemons, he naturally needs k evolution stones for every one of them, as well.

Now it takes little Arihant one complete day, to use the evolution stone on one Pokemon. And for each Pokemon, he knows how many days will they take to evolute after the evolution stone has been used on them.

He will go to meet Professor Oak, the very next day, once all his Pokemons have gone through evolution. He can select the order of applying evolution stones as he likes, so he wants to do it in such a way that he gets to meet Professor Oak as soon as possible!

## HackerEarth Gotta catch 'em all! problem solution.

`#include <bits/stdc++.h>using namespace std;struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0);cout.tie(0); } } _;#define lct long long int t;cin>>t;while(t--)#define llin(a) ll a; cin>>a;#define rep(i,n) for(ll i=0;i<n;i++)typedef long long int ll;int main(){    llin(n);    ll arr[n];    rep(i,n)        cin>>arr[i];    sort(arr,arr+n);    ll cnt=1,buf=arr[n-1];    for(ll i=n-2;i>=0;i--)    {        if(arr[i]<buf)        {            buf--;            cnt++;        }        else        {            cnt++;            buf=arr[i];        }    }    cnt+=buf;    cout<<++cnt<<endl;}`

### Second solution

`from sys import *n = int(stdin.readline())a = map(int, stdin.readline().split())#print aa = sorted(a, reverse = True)#print aprint max(i + a[i] + 2 for i in range(n))`