import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    char[] ch = s.nextLine().toCharArray();
    int[] counts = new int[2];
    for (int j = 0; j < ch.length; j++) {
      if (ch[j] == 'I') counts[0]++;
      else if (ch[j] == 'A') counts[1]++;
    }
    int cows = 0;
    if (counts[0] == 0) cows = counts[1];
    else if (counts[1] == 1) cows = 1;
    System.out.println(cows);
  }
}
