13921 - NumberLine Segmentation   

Description

There’s a numberline. Initially, no point is lying on it.
Given N queries, each is one of the following two types:
1 x: Add a point x on the numberline. If x is already lying on the numberline, remove it instead.

2 x: There are a lot of segments, separated by the points on the numberline. You have to answer the length of the segments that x is lying on. If x is the endpoints of two segments, x is considered lying on the right one. Furthermore, if the length of the segment is infinite, output −1.

Constraints

  • 1 ≤ N ≤ 100000
  • 1 ≤ x ≤ 1000000000

Input

 

The first line contains a integer N represents the number of queries.
In the following N lines, each contains two integers, represents the query.

Output

 

For each query of type 2, outputs its answer line by line.

Sample Input  Download

Sample Output  Download

Tags




Discuss