/*
By: Anurag Rai
CF: Raag07
CC: call_me_raag
*/
#include<bits/stdc++.h>
#define FIO	   				std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(it, a, b)		for(int it = a; it < b; ++it)
#define all(X)				(X).begin(), (X).end()
#define int    				long long int
#define ff					first
#define ss					second
#define pb					push_back
#define sq(X)				(X) * (X)
#define mod    				1000000007
using namespace std;

int max(int a, int b) { return a > b ? a : b; }
int min(int a, int b) { return a < b ? a : b; }
int gcd(int a, int b) {	return b ? gcd(b, a % b) : a; }
bool comp(int a, int b) { return a > b; }
bool sortbySS(const pair<int, int> &A, const pair<int, int> &B) { return A.ss < B.ss; }


void solve() {
	// Write your code here

	string S;
	cin >> S;

	int count = 0;
	for (int i = 1; i < S.length(); ++i) {
		if (S[i] == 'O' && S[i - 1] == 'Z' && S[i + 1] == 'N' && S[i + 2] == 'e') {
			count++;
			i += 2;
		}
	}

	cout << count;
}
int32_t main() {
	FIO;

	int t = 1;
	// cin >> t;

	while (t--) {
		solve();
	}

	return 0;
}

///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define ll long long
#define pll  pair<ll,ll>

#define ff    first
#define ss    second

#define  mp  make_pair
#define  pb  push_back

#define cy  cout<<"YES"<<endl
#define cn   cout<<"NO"<<endl


using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int mod2=2147483647; ///2^31-1
const int M=500005;

ll a[M];



int main()
{
    int h, w, x, y;
    cin >> h >> w >> x >> y;
    vector<string> s(h + 1);
    for(int i = 1; i <= h; i++) cin >> s[i];
    int res = 0;
    for(int i = y - 1; i > 0; i--){
        if(s[x][i-1] == '#') break;
        res++;
    }
    for(int i = x - 1; i > 0; i--){
        if(s[i][y-1] == '#') break;
        res++;
    }
    for(int i = y + 1; i <= w; i++){
        if(s[x][i-1] == '#') break;
        res++;
    }
    for(int i = x + 1; i <= h; i++){
        if(s[i][y-1] == '#') break;
        res++;
    }
    res++;
    cout << res << endl;
}
