Note
In the first sample the sequence
ai looks as follows:
(0,1,1,0). All the possible subsequences are:
(),(0),(0,0),(0,1),(0,1,0),(0,1,1),(0,1,1,0),(1),(1,0),(1,1),(1,1,0).
In the second sample the sequence
ai looks as follows:
(0,1,2,3,4,5,6). The subsequences of this sequence are exactly all increasing sequences formed from numbers from 0 to 6. It is easy to see that there are
27=128 such sequences.