#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  string S; cin>>S;
  int ans=0;
  for(int i=0;i+3<S.size();i++)ans+=S.substr(i,4)=="ZONe";
  cout<<ans<<endl;
}
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++)
#define rrep(i, a, b) for (int i = (int)(b) - 1; (i) >= (int)(a); (i)--)
#define all(v) v.begin(), v.end()

typedef long long ll;
template <class T> using V = vector<T>;
template <class T> using VV = vector<V<T>>;

/* 提出時これをコメントアウトする */
#define LOCAL true

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    constexpr char endl = '\n';
    
    string s;
    cin >> s;
    int ans = 0;
    rep(i,0,s.size() - 3) {
        if (s.substr(i,4) == "ZONe") ans++;
    }
    cout << ans << endl;
    
    return 0;
}