Athenaeus has recently wrapped up making his most recent melodic piece and will introduce it tomorrow to individuals of Athens. Tragically, the tune is somewhat dull and almost certain will not be met with a warm gathering. His tune comprises of n notes, which we will treat as certain integers. The variety of a tune
Correct answer will be upvoted else Multiple Downvoted. Computer science.
Athenaeus has recently wrapped up making his most recent melodic piece and will introduce it tomorrow to individuals of Athens. Tragically, the tune is somewhat dull and almost certain will not be met with a warm gathering.
His tune comprises of n notes, which we will treat as certain integers. The variety of a tune is the number of various notes it contains. As a supporter of music, Euterpe looks after arrangers and guides them all through the method involved with making new tunes. She chose to help Athenaeus by changing his melody to make it more assorted.
Being a minor goddess, she can't self-assertively change the tune. All things being equal, for every one of the n notes in the tune, she can either leave it for what it's worth or increment it by 1.
Given the tune as an arrangement of integers portraying the notes, discover the maximal, attainable variety.
Input
The input comprises of numerous experiments. The principal line contains an integer t (1≤t≤10000) — the number of experiments. Then, at that point, t experiments follow, every one is portrayed in two lines.
In the principal line of each experiment there is a solitary integer n (1≤n≤105) meaning the length of the melody. The following line contains an arrangement of n integers x1,x2,… ,xn (1≤x1≤x2≤… ≤xn≤2⋅n), portraying the melody.
The amount of n over all experiments doesn't surpass 105.
Output
For each experiment, you should output a solitary line containing exactly one integer, the maximal variety of the melody, for example the maximal conceivable number of various components in the last succession.
Step by step
Solved in 4 steps with 1 images