#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
typedef long long ll;
#define f(i,start,end) for(i=start;i<=end;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<pii,int>
#define F first
#define S second
#define min_heap priority_queue<ll, vector<ll>, greater<ll> >
#define max_heap priority_queue<ll>
#define min_heap_pair priority_queue<pii, vector<pii>, greater<pii> >
#define eb emplace_back
#define mapGreater map<int, int, greater<int> >
//#define pi 3.14159265
#define printAr(a, n) f(i, 0, n-2) cout << a[i] << ' '; cout << a[n-1] << nl;

// Implementation of Ordered Set - PBDS
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree< int,
              null_type,
              less<int>,
              rb_tree_tag,
              tree_order_statistics_node_update
            > ordered_set;
*/

inline bool pair_cmp(pii p1, pii p2)
{
    if(p1.S!=p2.S) return p1.S<p2.S;
    return p1.F<p2.F;
}

const int64_t INF = 1e18+7;
inline int64_t mul(int64_t a, int64_t b){
    return (INF/a>b? a*b: INF);
}
inline int64_t add(int64_t a, int64_t b){
    return (INF-a>b? a+b: INF);
}

//sieve of eratosthenes

bool p[1000001];
void sieve()
{
    //all odds + falses are primes (>= 2)
    for(int i=4; i<=1000000; i+=2)
        p[i] = 1;
    for(int i=3; i*i<=1000000; i+=2)
    {
        if(!p[i])
        {
            for(int j=i*i; j<=1000000; j+=(2*i))
            {
                p[j] = 1;
            }
        }
    }
}

void solve()
{
    int i=0, j=0;
    string s; cin >> s;
    int n = s.size();
    f(i, 0, n-4+1)
    {
        if(s.substr(i,4)=="ZONe") j++;
    }
    cout << j << nl;
}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); //fastio;
    //sieve();
    //int t=0,tc=0; cin >> tc; for(t=1; t<=tc; ++t)
    {
        //cout << "Case " << t << ": ";
        solve();
        //if(t<tc) cout << '\n';
    }
    return 0;
}

#include<bits/stdc++.h>
typedef long long ll; 
using namespace std;
int main()
{
	string str;
	cin >> str;
	int num=0;
	int index=0;
	string sub="ZONe";
	while( (index=str.find(sub,index)) < str.length() ){
		num++;
		index++;
	}
	cout << num << endl;
	return 0;
 } 