题目描述
There has been yet another murder in the Shady city of Riverdale. This murder is being investigated by none other than the Riverdale's Finest- Jughead Jones & Betty Cooper. This murder has been done exactly in the same manner as all the murders happening since the return of the deadly game Gargoyle &Griffins. Betty has decided to put an end to these murders, so they decide to interrogate each and every person in the neighbourhood.
As they don't know these people personally they want to first get to know about their character i.e whether a particular person is a Truth−speaking−person$Truth-speaking-person$ or a False−speaking−person$False-speaking-person$. Jughead devises a strategy of interrogating the civilians.
Jughead decides that they will collect statements from all the people in the neighbourhood about every other person living in the neighbourhood. Each person speaks a statement in form of an array consisting of T$T$ and F$ F$, which tells us what he thinks about the ith$ith$ person. Let there be N$N$ people living in the neighbourhood. So if a person i$i$ is giving his/her statement, he/her will always call himself/herself a True person i.e Statement[i]=T$Statement[i]=T$.
So Jughead says that they will select the maximum$maximum$ number$number$ of people that maybe speaking the truth such that their statements don't contradict and then interrogate them further about the murder.
Help them pick the max no. of Truth speaking people.
Note$Note$- A person speaking falsely$falsely$ doesn't mean that the complement of his statement would be the truth$truth$. If a person is declared false[MATH13] after Betty and Jughead pick their set of truth speaking people with non-contradicting statements, the person declared false might not be speaking falsely$falsely$ about anyone(except saying he himself is a true$true$ speaking person which contradicts with the selected statements) but since the selected Set of statements feels him to be a false$false$ speaking person he won't be included in the set.
But if a person is tagged as truth$truth$ speaking person then their Statement must be entirely correct and should not contradict with the chosen set of truth$truth$ speaking people. All truth$truth$ speaking people mentioned in the selected statements should be part of the set and all the people declared false$false$ in the statements shouldn't be part of the set.
See example for clarity.
-----Input:-----
- First line will contain N$N$, the number of people in the neighbourhood. Then the Statements of ith$ith$ person follow.
- Each Statement contains a single line of input, an array of length N$N$ consisting of T$T$ and F$F$.
-----Output:-----
Print a single line denoting the maximum no. of people that might be speaking the truth.
-----Constraints-----
- 1≤N≤1000$1 \leq N \leq 1000$
- Statement$Statement$i$i$[i]=T$[i]=T$
-----Sample Input1:-----
5
T T F F F
T T F F F
T T T F F
F F F T T
F F F T T
-----Sample Output1:-----
2
-----Sample Input2:-----
3
T T T
T T T
F F T
-----Sample Output2:-----
1
-----EXPLANATION:-----
In Sample 1
We can consider the 1st$1st$ and 2nd$2nd$ person to be speaking the truth. We can also consider the 4th$4th$ and the 5th$5th$ person to be speaking the truth.
Note$Note$: we cannot select 1st$1st$ 2nd$2nd$ and 3rd$3rd$ person because the 1st$1st$ and the second person have labelled the 3rd person as a false speaking person, therefore if we select all 3 contradiction will arise.
In sample 2
Set contains only the 3rd person
输入格式
见题面
输出格式
见题面