#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  string s;
  cin >> n >> s;
  int a = 0, f = 0, i = 0;
  for (int k = 0; k < n; k++) {
    if (s[k] == 'A') a++;
    if (s[k] == 'F') f++;
    if (s[k] == 'I') i++;
  }
  cout << a << " " << f << " " << i << endl;
  if (i == 1)
    cout << 1 << endl;
  else if (i > 1)
    cout << 0 << endl;
  else
    cout << a << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  solve();
}
