페이지가 로드되지 않나요? 여기를 눌러보면 고쳐질 수도 있어요.
Placeholder

#3889

Cow Art 1000초 128MB

문제


입력

* Line 1: The integer N.

* Lines 2..1+N: Each line contains a string with N characters, describing one row of a painting.


출력

* Line 1: Two space-separated integers, telling the number of regions in the painting when viewed by a human and by a cow.


예제1

입력
5
RRRBB
GGBBB
BBBRR
BBRRR
RRRRR
출력
43

출처

USACO 2014 March Bronze

역링크 공식 문제집만