#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace std;
 
// #pragma GCC optimize("O3","unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC target("avx2")
 
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k) -> iterator of kth element (in sorted fashion : low - high)
// order_of_key(x) -> #numbers strictly less than x
 
#define sync ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
#define unq(a) sort(all(a));a.resize(unique(all(a)) - a.begin())
#define F first
#define S second
#define endl '\n'
 
using pii = pair<int , int>;
using ll = long long;
using ld = long double;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//mt19937 rng(0);
 
 
int main(){
    sync
 
    #ifndef ONLINE_JUDGE 
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    int t = 1;
    //cin >> t;
    while(t--){
      string s;
      cin >> s;
      int cnt = 0;
      for (int i = 0; i < s.size(); i++){
        string r;
        for (int x = 4, j = i; j < s.size() && x > 0; j++,x--){
          r += s[j];
        }
        
        cnt += (r == "ZONe");
      }
      cout << cnt << endl;
    }
 
    cerr << "processor time: " << clock() / (double) CLOCKS_PER_SEC << "s    ";
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin>>S;
  int cnt=0;
  for(int i=0;i<9;i++){
    string T=S.substr(i,4);
    if(T=="ZONe") cnt++; 
  }
  cout<<cnt<<endl;
}