You are given an array containing integers and you have to answer queries. Each query contains an integer which is the index of the (1 based index) element of the queue.
Write a program to determine the following for each query:
Note:
Segment formation example: You have 3 numbers 1, 2, and 3.
The possible segments for 3 are [3], [2,3] and [1,2,3]. Similarly, the possible segments for 2 are [2],[1,2].
Input format
Output format
Print the answer to each query.
Constraints
For first query all possible valid segments are [4], [4,1] ,[4,1,2] , [4,1,2,3] hence answer is 4.