Death Knight Hero

No attempts yetTime limit1sMemory limit128 MB

Problem

There once was a champion of WoW, Arthasdk the name he was bestowed. He Death Gripped you to his side, His Chains of Ice stopped your stride, And Obliterates made you say "OWW!"

But one day our hero got puzzled, His Death Grip totally fizzled. In his darkest despair, He could barely hear, "OMG NOOB u Chains of Iced then u Death Gripped."

Input

You are given a recording of the abilities our hero used in his battles.

The first line of input contains a single integer $n$ ($1 \le n \le 100$), the number of battles our hero played.

Then follow $n$ lines, each with a sequence of $k_i$ ($1 \le k_i \le 1000$) characters, each of which is either 'C', 'D', or 'O'. These denote the sequence of abilities used by our hero in the $i$-th battle. 'C' is Chains of Ice, 'D' is Death Grip, and 'O' is Obliterate.

Output

Output the number of battles our hero won. He won each battle in which he did not use Chains of Ice ('C') immediately followed by Death Grip ('D') — that is, count the battles whose ability string does not contain "CD" as a substring.