/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Pine1999
 */

#include <bits/stdc++.h>

using namespace std;

void CNeqMin(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    vector<int> p(n);
    vector<bool> exist(400050);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        in >> p[i];
        exist[p[i]] = true;
        while (exist[ans]) ++ans;
        out << ans << '\n';
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    CNeqMin(in, out);
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define mod 1000000007
#define ps(x, y) fixed << setprecision(y) << x
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define fastIO                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (int i = k; i < n; i++)


int32_t main(){
string str;
cin >> str;
int count = 0;
for(int i = 0; i < str.size(); i++){
    if(str[i]=='Z' && str[i+1]=='O' && str[i+2]=='N' && str[i+3]=='e'){
        count++;
        i += 3;
    }
}
cout << count << endl;
    return 0;
}
