#include
#include
#include
#include
int main(int argc, char * argv[]) {
int n;
scanf("%d", &n);
int a[n][n];
for(int i = 0; i < n; i++) {
for(int j= 0; j < n; j++) {
scanf("%d", &a[i][j]);
}
}
int m;
scanf("%d", &m);
int b[m][m];
for(int i = 0; i < m; i++) {
for(int j = 0; j < m; j++) {
scanf("%d", &b[i][j]);
}
}
for(int i = 0; i < n / 2; i++) {
for(int j = 0; j < m; j++) {
int x = a[i][j];
int y = a[n - 1 - i][j];
a[i][j] = y;
a[n - 1 - i][j] = x;
}
}
int isti = 0;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(a[i][j] == b[i][j]) {
isti++;
}
}
}
if(isti == n*n) {
printf("Matricite se isti\n");
}
else {
printf("Isti se vo %d elementi\n", isti);
}
}
/*
4
1 2 10 0
7 2 3 1
6 0 5 4
4 1 0 1
4
4 1 0 1
6 0 5 4
7 2 2 1
1 1 10 0
**/