#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
#define println(x) cout << x << endl
#define print(x) cout << x << " "
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    string s;
    cin >> s;
    itn time  = 0;
    FOR(i,3,s.size()){
        string a;
        a.push_back(s[i - 3]);
        a.push_back(s[i - 2]);
        a.push_back(s[i - 1]);
        a.push_back(s[i]);
        if(a == "ZONe") time++;
    }

    println(time);
    return 0;
}
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
using namespace std;

int main(){
    long N,i,ans;
    cin>>N;
    string a,b,c;
    for(i=0;i<N;++i){
        a.replace(i,1,"1");
        b.replace(i,1,"1");
        c.replace(i,1,"1");
        if(i%3==0){
            c.replace(i,1,"0");
        }
        else if(i%3==1){
            b.replace(i,1,"0");
        }
        else{
            a.replace(i,1,"0");
        }
    }
    string T;
    cin>>T;
  if(N>=2){
    if(T.compare(a)==0){
        ans=1e10-(N+2)/3+1;
    }
    else if(T.compare(b)==0){
        ans=1e10-N/3;
    }
    else if(T.compare(c)==0){
        ans=1e10-(N+1)/3;
    }
    else{
        ans=0;
    }
}
  if(N==1){
        if(T.compare("1")==0){
            ans=2*1e10;
        }
        else{
            ans=1e10;
        }
    }
    cout<<ans<<endl;
    return 0;
}