#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<char, int> mp;
  for (char c : s) {
    mp[c]++;
  }
  string target = "nineteen", ans = "";
  int ind = 0, res = 0, n = target.size();
  while (true) {
    if (mp[target[ind]] == 0) {
      break;
    }
    if (ans.back() == target[ind] && ind == 0) {
      ind++;
      ind %= n;
      continue;
    }
    ans += target[ind];
    mp[target[ind]]--;
    ind++;
    res += (ind == n);
    ind %= n;
  }
  cout << res << endl;
  return 0;
}
