Given an initially empty heap, you are asked to perform q queries. There are 2 types of queries:

add x - should add x to the heap

pop - should delete the root of the heap

For each of the queries, you are asked to print the number of swaps needed to restructure the heap to make it satisfy the max-heap property.

For the pop operations, the swapping of the root and the last element is also counted as a swap.

Input

The first line of the input contains a single integer q (1 β€ q β€ ).

The next q lines contain queries - each on a separate line. Itβs guaranteed that for all add queries the value of x does not exceed in absolute value.

Output

The program should print the number of swap operations each on a separate line.