#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define swap(a,b) (a^=b^=a^=b)
#define ll long long int
#define ull unsigned long long int
#define uint unsigned int
#define format(a) memset(a,0,sizeof(a))
#define rep(x,y,z) for(int x=y;x<=z;x++)
#define dec(x,y,z) for(int x=y;x>=z;x--)
#define mst(x) memset(x,0,sizeof(x))
const int maxn=105;
inline int read()
{
    int ans=0;
    char last=' ',ch=getchar();
    while(ch<'0'|ch>'9')last=ch,ch=getchar();
    while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
    if(last=='-')ans=-ans;
    return ans;
}
string s,tar="ZONe";
int main()
{
    cin>>s;
    int n=s.size();
    rep(i,1,3)s=s+'#';
    int cnt=0;
    rep(i,0,n-1)
    {
        string k="";
        k+=s[i];
        k+=s[i+1];
        k+=s[i+2];
        k+=s[i+3];
        if(k==tar)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}



#include <string>
#include <algorithm>
#include <iostream>


int main()
{
    std::string t = "ZONe";
    std::string s;
    std::cin >> s;

    int letter_count = s.size();
    int count = 0;
    for(int i = 0; i < letter_count-1; i++)
    {
        if(std::equal(std::begin(t), std::end(t), std::begin(s)+i)){
            count++;
        }
    }

    std::cout << count << std::endl;
    return 0;
}
