#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define pi pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>

ll mod = 1e9+7;
const int IMAX = 2000500;
const int V = 2100;
const ll LMAX = 99999999999999999;
const ll p = 1000000000;
int R[] = {-1,0,1,0};
int C[] = {0,1,0,-1};

void solve(int test)
{
    string s,s1;
    cin>>s;
    
    int n = s.length(),cnt=0;
    for(int i=0;i<=n-4;i++)
    {
        s1 = s.substr(i,4);
        
        if(s1 == "ZONe")
            cnt++;
    }
    
    cout<<cnt<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int t;
    // cin>>t;
    t = 1;
    // preprocess();
    for(int i=1;i<=t;i++)
        solve(i);
}

/////////////////////////////////// UNION - FIND ////////////////////////
/*void initialize()
{
    for(int i=0;i<MAXM;i++)
    {
        root[i] = i;
        size[i] = 1;
    }
}
 
int find(int a)
{
    while(a!=root[a])
    {
        root[a] = root[root[a]];
        a = root[a];
    }
    
    return a;
}
 
void merge(int a,int b)
{
    int roota = find(a);
    int rootb = find(b);
    if(size[roota] < size[rootb])
    {
        size[rootb] += size[roota];
        root[roota] = root[rootb];
    }
    else
    {
        size[roota] += size[rootb];
        root[rootb] = root[roota];
    }
}*/
#include <bits/stdc++.h>
using namespace std;
long long n, ans;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
long long lo=0, hi=1500000007;
while (lo<hi){
	long long mid=(lo+hi+1)/2;
	long long cur = mid*(mid+1)/2;
	if (cur <= (n+1)) lo=mid;
	else hi=mid-1;
} 
cout << (n-lo+1);
return 0;
}
