You are given a sequence of positive integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. 

While possible, you perform the following operation: find a pair of equal consecutive elements. If there are more than one such pair, find the leftmost (with the smallest indices of elements). If the two integers are equal to *x*, delete both and insert a single integer *x* + 1 on their place. This way the number of elements in the sequence is decreased by 1 on each step. 

You stop performing the operation when there is no pair of equal consecutive elements.

For example, if the initial sequence is [5, 2, 1, 1, 2, 2], then after the first operation you get [5, 2, 2, 2, 2], after the second — [5, 3, 2, 2], after the third — [5, 3, 3], and finally after the fourth you get [5, 4]. After that there are no equal consecutive elements left in the sequence, so you stop the process.

Determine the final sequence after you stop performing the operation.
The first line contains a single integer *n* (2 ≤ *n* ≤ 2·10<sup class="upper-index">5</sup>) — the number of elements in the sequence.

The second line contains the sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).
The first example is described in the statements.

In the second example the initial sequence is [1000000000, 1000000000, 1000000000, 1000000000]. After the first operation the sequence is equal to [1000000001, 1000000000, 1000000000]. After the second operation the sequence is [1000000001, 1000000001]. After the third operation the sequence is [1000000002].

In the third example there are no two equal consecutive elements initially, so the sequence does not change.
6
5 2 1 1 2 2
2
5 4 
4
1000000000 1000000000 1000000000 1000000000
1
1000000002 
7
4 10 22 11 12 5 6
7
4 10 22 11 12 5 6 
2
1 1
1
2 
3
2 1 1
1
3 
4
3 2 1 1
1
4 
7
5 5 4 4 5 6 7
3
7 6 7 
# include <bits/stdc++.h>
# define mem(a,b) memset(a,b,sizeof(a))
# define debug freopen("r.txt","r",stdin)
# define lb(x) ((x) & -(x))
# define pi pair<int,int>
# define X first
# define Y second
using namespace std;
typedef long long ll;
int st[200004],n,p=0;
int main(){
    //debug;
    scanf("%d",&n);
    int t;
    for(int i=1;i<=n;i++){
        scanf("%d",&t);
        while(p>0&&st[p]==t) --p,++t;
        st[++p]=t;
    }
    printf("%d\n",p);
    for(int i=1;i<=p;i++)
        printf("%d%c",st[i]," \n"[i==p]);
}
