import java.io.*;
import java.util.*;
public class Main {
static char[][] map1,map2;
static int[][] v1,v2;
static int[][] d=new int[][]{{-1,0},{1,0},{0,-1},{0,1}};
static int n;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
n=Integer.parseInt(br.readLine());
map1=new char[n][n];
map2=new char[n][n];
v1=new int[n][n];
v2=new int[n][n];
for(int i=0;i<n;i++){
String s=br.readLine();
for(int j=0;j<n;j++){
if(s.charAt(j)=='R'){
map1[i][j]=s.charAt(j);
map2[i][j]=s.charAt(j);
}
else if(s.charAt(j)=='G'){
map1[i][j]=s.charAt(j);
map2[i][j]='R';
}
else {
map1[i][j]=s.charAt(j);
map2[i][j]=s.charAt(j);
}
}
}
int red=0,green=0,blue1=0,redGreen=0,blue2=0;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(v1[i][j]==0){
bfs(i,j,map1,v1);
if(map1[i][j]=='R')red++;
else if(map1[i][j]=='G')green++;
else blue1++;
}
if(v2[i][j]==0){
bfs(i,j,map2,v2);
if(map2[i][j]=='R')redGreen++;
else blue2++;
}
}
}
System.out.println((red+green+blue1)+" "+(redGreen+blue2));
}
static void bfs(int y,int x,char[][] map,int[][] v){
char c=map[y][x];
Queue<int[]> q=new LinkedList<>();
q.add(new int[]{y,x});
v[y][x]=1;
while(!q.isEmpty()){
y=q.peek()[0];
x=q.peek()[1];
q.poll();
for(int i=0;i<4;i++){
int dy=y+d[i][0];
int dx=x+d[i][1];
if(dy<0||dx<0||dy>=n||dx>=n)continue;
if(map[dy][dx]==c && v[dy][dx]==0){
q.add(new int[]{dy,dx});
v[dy][dx]=1;
}
}
}
}
}
#bfs