SP138 POSTERS - Election Posters

Description

A parliamentary election was being held in Byteland. Its enterprising and orderly citizens decided to limit the entire election campaign to a single dedicated wall, so as not to ruin the panorama with countless posters and billboards. Every politician was allowed to hang exactly one poster on the wall. All posters extend from top to bottom, but are hung at different points of the wall, and may be of different width. The wall is divided horizontally into sections, and a poster completely occupies two or more adjacent sections. With time, some of the posters were covered (partially or completely) by those of other politicians. Knowing the location of all the posters and the order in which they were hung, determine how many posters have at least one visible section in the end.

Input Format

The input begins with the integer t, the number of test cases. Then t test cases follow. Each test case begins with a line containing integer n - the number of posters (1

Output Format

For each test case output a line containing one integer - the number of posters with visible sections.