시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 42 16 10 38.462%

문제

면 옛날에 좌표평면위에 빨간점과 파란점이 살고 있었다. 빨간점과 파란점은 몇 년동안 화목하게 지내고 있었다. 그런데... 파란점이 빨간점을 공격하기 시작했다. 빨간점은 파란점으로부터 자신들을 지키기 위해 두 평행선을 긋기로 결정했다. 두 선 사이에는 파란점이 있으면 안되며, 그 안에 있는 빨간점은 보호받을 수 있다. 선은 점을 지날 수 없다.

빨간점은 모든 빨간점이 보호받을 수 없음을 알게되었다. 보호받을 수 있는 빨간점 개수의 최대값을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 점의 개수 N이 주어진다. (1 ≤ N ≤ 1000)

다음 N개 줄에는 각 점의 좌표와 색상이 주어진다. 좌표는 절대값이 109보다 작은 정수쌍이고 색상은 'R'또는 'B'이다.

세 점이 일직선상에 있는 경우는 없다.

출력

두 평행선으로 보호받을 수 있는 빨간점 개수의 최대값을 출력한다.

예제 입력 1

8
2 -3 R
4 -1 R
-2 0 R
-3 1 B
-2 3 R
1 4 R
2 1 B
0 -3 B

예제 출력 1

3

힌트

W3sicHJvYmxlbV9pZCI6IjMxMjEiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWJlNjhcdWFjMDRcdWM4MTAsIFx1ZDMwY1x1Yjc4MFx1YzgxMCIsImRlc2NyaXB0aW9uIjoiPHA+XHViYTc0IFx1YzYxYlx1YjBhMFx1YzVkMCBcdWM4OGNcdWQ0NWNcdWQzYzlcdWJhNzRcdWM3MDRcdWM1ZDAgXHViZTY4XHVhYzA0XHVjODEwXHVhY2ZjIFx1ZDMwY1x1Yjc4MFx1YzgxMFx1Yzc3NCBcdWMwYjRcdWFjZTAgXHVjNzg4XHVjNWM4XHViMmU0LiBcdWJlNjhcdWFjMDRcdWM4MTBcdWFjZmMgXHVkMzBjXHViNzgwXHVjODEwXHVjNzQwIFx1YmE4NyBcdWIxNDRcdWIzZDlcdWM1NDggXH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