#include<bits/stdc++.h>
using namespace std;
int main()
{
    int m,n,i,j,x,y,t,a[200][200],s=0;
    cin>>m>>n;
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            cin>>a[i][j];
        }
    } 
    cin>>x>>y;
    x--;
    y--;
    for(j=0;j<n;j++){
        if(a[x][j]==a[x][y]){
            s++;
        }
    }
    for(j=0;j<m;j++){
        if(a[j][y]==a[x][y]){
            s++;
        }
    }
    cout<<s-2;
}
/**************************************************************
	Problem: 1998
	User: wengsihan
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2104 kb
****************************************************************/