Unreachable Functions

Time limit1sMemory limit128 MB

Problem

When analyzing source code in a programming language, it can be useful to know whether some functions will never execute. Such functions may indicate an error in the code.

In this problem, we consider a simple programming language made only of the following kinds of functions.

  • RADI: execution continues with the next function.
  • IDI a: execution moves to the a-th function.
  • IDI a ILI b: execution moves to either the a-th or the b-th function.

The program always starts at the first function.

Write a program that calculates how many functions will never execute.

Input

Each line of input contains one function. The i-th line contains the i-th function.

After the last function, the next line contains a period .. This line is not part of the program and is not counted as a function.

The number of functions is at most 10,000.

Output

Print one line containing the number of functions that will never execute.