Set and Sequence and Query

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Takina and Chisato are playing a game with a set of positive integers.

This game is about making continuous increasing sequences using the numbers from the set.

A continuous increasing sequence is defined as a sequence a_1,a_2,,a_ka\_1,a\_2,\dots ,a\_k of positive length kk, satisfying a_i+1=a_i+1a\_{i+1}=a\_i+1 for all 1ik11\leq i\leq k-1.

The game begins with an empty set and consists of QQ turns. In each turn, Takina can either insert a new integer into the set or delete an integer from the set.

Every time a change is made to the set, Chisato has to count how many different continuous increasing sequences can be made using the numbers from the set.

Your task is to help Chisato.

입력

The first line contains the number of turns, QQ.

The following QQ lines contain two integers, describing Takina’s move. Each line has one of the following forms:

  • 1 xx : Insert xx into the set. It is guaranteed that xx was not in the set.
  • 2 xx : Delete xx from the set. It is guaranteed that xx was in the set.

출력

Output QQ integers separated by newlines, the number of continuous increasing sequences in the set after each Takina’s move.

제한

  • 1Q300,0001\leq Q\leq 300\\, 000
  • 1x1091\leq x\leq 10^9