#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, countA = 0, countI = 0;
  cin >> n;
  char a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == 'A')
      countA++;
    else if (a == 'I')
      countI++;
  }
  cout << countA << endl << countI << endl;
  if (countI == 0) {
    cout << countA;
    return 0;
  } else {
    cout << countI;
    return 0;
  }
}
