This Sentence is False

No attempts yetTime limit1sMemory limit128 MB

Problem

The court of King Xeon 2.4 is riddled with intrigue and conspiracy. A document recently obtained by the King's Secret Service is suspected to be part of some mischievous scheme. The document is simply a set of sentences that state the truth or falsehood of one another. Each sentence has the form “Sentence X is true.” or “Sentence X is false.”, where X identifies one sentence in the set (possibly the sentence itself). The Secret Service suspects that the sentences in fact refer to another, yet undiscovered, document.

Each sentence may be assigned a value of true or false. An assignment is valid when, for every sentence, the sentence is true exactly when the claim it makes about sentence X actually holds.

Decide whether the set of sentences is consistent, that is, whether a valid assignment exists. If it is consistent, determine the maximum number of sentences that can be made true in a valid assignment.

Input

The input contains several documents. Each document begins with a line holding a single integer $N$, the number of sentences in the document ($1 \le N \le 1000$). The next $N$ lines each contain one sentence. Sentences are numbered sequentially in the order they appear (the first is sentence 1, the second is sentence 2, and so on). Each sentence has the form “Sentence X is true.” or “Sentence X is false.”, where $1 \le X \le N$. A value of $N = 0$ marks the end of the input.

Output

For each document, output one line. If the document is consistent, print the maximum number of sentences that can be true in a valid assignment. Otherwise, print the word ‘Inconsistent’.