///#include <stdio.h>
///#include <iostream>
///#include <cstring>
///#include <cmath>
///#include <algorithm>
///#include <string>
///#include <vector>
///#include <map>
///#include <set>
///#include <queue>
///#include <cstdlib>
///#include <limits>
///#include <iostream>
///#include <sstream>
///#include <unordered_set>
///#include <unordered_map>
///#include <random>
#include <bits/stdc++.h>
///#include <bits/stdtr1c++.h>
///#include <ext/pb_ds/assoc_container.hpp>
///#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
///using namespace __gnu_pbds;

#define              MAX             500005
#define              EPS             1e-9
#define              ull             unsigned long long
#define              ll              long long
#define              inf             INT_MAX
#define              pi              acos(-1.0)
#define              vi              vector<int>
#define              vl              vector<long long>
#define              pii             pair<int,int>
#define              pll             pair<long long,long long>
#define              mp              make_pair
#define              mem(a, v)       memset(a, v, sizeof (a))
#define              mod             1000000007
#define              all(a)          a.begin(),a.end()
#define              rall(a)         a.rbegin(),a.rend()
#define              ff              first
#define              ss              second
#define              arsort(ar,n)    sort(ar,ar+n);
#define              vsort(v)        sort(v.begin(),v.end())
#define              vrev(v)         reverse(v.begin(),v.end())
#define              arrev(ar,n)     reverse(ar,ar+n)
#define              pb              push_back
#define              popb            pop_back
#define              booster()       ios_base::sync_with_stdio(0); cin.tie(0);
#define              read(f)         freopen(f, "r", stdin)
#define              scani(x)        scanf("%d",&x)
#define              scanl(x)        scanf("%I64d",&x)
#define              scand(x)        scanf("%lf",&x)
#define              scans(x)        scanf("%s",x)
#define              OUT(x)          printf("%d\n",x)
#define              OUTS(x)         printf("%d ",x)
#define              min3(a,b,c)     min(a,min(b,c))
#define              max3(a,b,c)     max(a,max(b,c))
#define              min4(a,b,c,d)   min(min(a,b),min(c,d))
#define              max4(a,b,c,d)   max(max(a,b),max(c,d))
#define              max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define              min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))

#define              bitCheck(a,k)     ((bool)(a&(1<<(k))))
#define              bitOff(a,k)       (a&(~(1<<(k))))
#define              bitOn(a,k)        (a|(1<<(k)))
#define              bitFlip(a,k)      (a^(1<<(k)))

#define              POPCOUNT           __builtin_popcount
#define              POPCOUNTLL         __builtin_popcountll
#define              RIGHTMOST          __builtin_ctzll
#define              LEFTMOST(x)        (63-__builtin_clzll((x)))

#define scani2(a,b) scani(a) , scani(b)
#define scani3(a,b,c) scani(a), scani(b), scani(c)
#define scani4(a,b,c,d) scani(a), scani(b), scani(c), scani(d)
#define scani5(a,b,c,d,e) scani(a), scani(b), scani(c), scani(d) , scani(e)
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*********************Ordered Multiset*************************/

/*** Needs C++11 or C++14 ***/
/// Treap supporting duplicating values in set
/// Maximum value of treap * ADD must fit in long long

/*

struct Treap{ /// hash = 96814
    int len;
    const int ADD = 1000010;
    const int MAXVAL = 1000000010;
    tr1::unordered_map <long long, int> mp; /// Change to int if only int in treap
    tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> T;
    Treap(){
        len = 0;
        T.clear(), mp.clear();
    }
    inline void clear(){
        len = 0;
        T.clear(), mp.clear();
    }
    inline void insert(long long x){
        len++, x += MAXVAL;
        int c = mp[x]++;
        T.insert((x * ADD) + c);
    }
    inline void erase(long long x){
        x += MAXVAL;
        int c = mp[x];
        if (c){
            c--, mp[x]--, len--;
            T.erase((x * ADD) + c);
        }
    }
    /// 1-based index, returns the K'th element in the treap, -1 if none exists
    inline long long kth(int k){
        if (k < 1 || k > len) return -1;
        auto it = T.find_by_order(--k);
        return ((*it) / ADD) - MAXVAL;
    }
    /// Count of value < x in treap
    inline int count(long long x){
        x += MAXVAL;
        int c = mp[--x];
        return (T.order_of_key((x * ADD) + c));
    }
    /// Number of elements in treap
    inline int size(){
        return len;
    }
};

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;///*X.find_by_order();X.order_of_key();
template <class T> inline bool isLeap(T y) {return (y % 400 == 0) || (y % 100 ? y % 4 == 0 : false); }*/
template< class T > inline T gcd(T a, T b) { return (b) == 0 ? (a) : gcd((b), ((a) % (b))); }
template< class T > inline T lcm(T a, T b) { return ((a) / gcd((a), (b)) * (b)); }
template <class T> inline T BigMod(T Base,T power,T M=mod){if(power==0)return 1;if(power&1)return ((Base%M)*(BigMod(Base,power-1,M)%M))%M;else{T y=BigMod(Base,power/2,M)%M;return (y*y)%M;}}
template <class T> inline T ModInv (T A,T M = mod){return BigMod(A,M-2,M);}

int fx[] = {-1,+0,+1,+0,+1,+1,-1,-1,+0};
int fy[] = {+0,-1,+0,+1,+1,-1,+1,-1,+0};
int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

/*********************** let the play begin() *********************************/

/// ********** FASTER one *******************///
namespace mf
{
    const int MAXN = 10004;
    struct edge {
        int a, b, cap, flow ;
        edge(int _a,int _b,int _c,int _d) {
            a=_a,b=_b,cap=_c,flow=_d;
        }
    } ;

    int INF=1500000001;

    int n, s, t, d [ MAXN*2 ] , ptr [ MAXN*2 ] , q [ MAXN*2*10 ] ;
    vector < edge > e ;
    vector < int > g [ MAXN * 2 ] ;

    void addEdge ( int a, int b, int cap ,int cap2=0) {
        edge e1 =edge( a, b, cap, 0 ) ; /// forward cap
        edge e2 =edge( b, a, cap2 , 0 ) ; /// backward cap change here if needed
        g [ a ] . push_back ( ( int ) e. size ( ) ) ;
        e. push_back ( e1 ) ;
        g [ b ] . push_back ( ( int ) e. size ( ) ) ;
        e. push_back ( e2 ) ;
    }

    bool bfs ( ) {
        int qh = 0 , qt = 0 ;
        q [ qt ++ ] = s ;
        memset ( d, -1 , sizeof d ) ;
        d [ s ] = 0 ;
        while ( qh < qt && d [ t ] == - 1 ) {
            int v = q [ qh ++ ] ;
            for ( size_t i = 0 ; i < g [ v ] . size ( ) ; ++ i ) {
                int id = g [ v ] [ i ] ,
                    to = e [ id ] . b ;
                if ( d [ to ] == - 1 && e [ id ] . flow < e [ id ] . cap ) {
                    q [ qt ++ ] = to ;
                    d [ to ] = d [ v ] + 1 ;
                }
            }
        }
        return d [ t ] != -1;
    }

    int dfs ( int v, int flow ) {
        if ( ! flow )  return 0 ;
        if ( v == t )  return flow ;
        for ( ; ptr [ v ] < ( int ) g [ v ] . size ( ) ; ++ ptr [ v ] ) {
            int id = g [ v ] [ ptr [ v ] ] ,
                to = e [ id ] . b ;
            if ( d [ to ] != d [ v ] + 1 )  continue ;
            int pushed = dfs ( to, min ( flow, e [ id ] . cap - e [ id ] . flow ) ) ;
            if ( pushed ) {
                e [ id ] . flow += pushed ;
                e [ id ^ 1 ] . flow -= pushed ;
                return pushed ;
            }
        }
        return 0 ;
    }

    ll dinic ( ) {
        ll flow = 0 ;
        for ( ;; ) {
            if ( !bfs () )  break ;
            memset ( ptr, 0 , sizeof ptr ) ;
            while ( int pushed = dfs ( s, INF ) ) {
                flow += (ll)pushed ;
                if(pushed == 0)break;
            }
        }
        return flow ;
    }

    void init(int src, int dest , int nodes){
        e.clear();
        for(int i = 0;i<=n+n;i++) g[i].clear();
        n = nodes; s = src; t = dest;
    }
};

int prime[MAX],p,flag[MAX];
void sieve(int n){
	double z = sqrt(n);
	for(int i = 3;i<=z;i+=2){
		if(!flag[i]){
			for(ll j = i*i;j<=n;j+=i+i)flag[j] = 1;
		}
	}
	prime[p++] = 2;
	for(int i = 3;i<=n;i+=2){
		if(!flag[i])prime[p++] = i;
	}
}

int nn,arr[MAX];vi v[MAX],ans[MAX];int vis[MAX],cnt;

void dfs(int s){
	vis[s] = 1;
	ans[cnt].pb(s);
	for(auto it : v[s]){
		if(!vis[it])dfs(it);
	}
}

int main()
{
    booster()
    ///read("input.txt");

    sieve(10000);

    cin>>nn;
    for(int i = 0;i<nn;i++){
		cin>>arr[i];
    }

    mf::init(0,nn+1,nn+3);

    for(int i = 0;i<nn;i++){
		for(int j = i+1;j<nn;j++){
			if(!flag[arr[i]+arr[j]]){
				if(arr[i]&1)mf::addEdge(i+1,j+1,1);
				else mf::addEdge(j+1,i+1,1);
			}
		}
    }
    for(int i = 0;i<nn;i++){
		if(arr[i]&1)mf::addEdge(0,i+1,2);
		else mf::addEdge(i+1,nn+1,2);
    }
    int x = mf::dinic();
	///cout<<x<<endl;
    if(x!=nn)cout<<"Impossible";
    else {
        for(int i = 0;i<nn;i++){
            int sz = mf::g[i+1].size();
            for(int j = 0;j<sz;j++){
				int indx = mf::g[i+1][j];
				if(mf::e[indx].flow==1){
                    int a = mf::e[indx].a;
                    int b = mf::e[indx].b;
                    v[a].pb(b);
                    v[b].pb(a);
				}
            }
        }

		for(int i = 1;i<=nn;i++){
			if(!vis[i]){
				cnt++;
				dfs(i);
			}
		}

		for(int i = 1;i<=cnt;i++){
			cout<<ans[i].size()<<" ";
			for(auto it : ans[i])cout<<it<<" ";
			cout<<endl;
		}
    }

    return 0;
}


///#include <stdio.h>
///#include <iostream>
///#include <cstring>
///#include <cmath>
///#include <algorithm>
///#include <string>
///#include <vector>
///#include <map>
///#include <set>
///#include <queue>
///#include <cstdlib>
///#include <limits>
///#include <iostream>
///#include <sstream>
///#include <unordered_set>
///#include <unordered_map>
///#include <random>
#include <bits/stdc++.h>
///#include <bits/stdtr1c++.h>
///#include <ext/pb_ds/assoc_container.hpp>
///#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
///using namespace __gnu_pbds;

#define              MAX             500005
#define              EPS             1e-9
#define              ull             unsigned long long
#define              ll              long long
#define              inf             INT_MAX
#define              pi              acos(-1.0)
#define              vi              vector<int>
#define              vl              vector<long long>
#define              pii             pair<int,int>
#define              pll             pair<long long,long long>
#define              mp              make_pair
#define              mem(a, v)       memset(a, v, sizeof (a))
#define              mod             1000000007
#define              all(a)          a.begin(),a.end()
#define              rall(a)         a.rbegin(),a.rend()
#define              ff              first
#define              ss              second
#define              arsort(ar,n)    sort(ar,ar+n);
#define              vsort(v)        sort(v.begin(),v.end())
#define              vrev(v)         reverse(v.begin(),v.end())
#define              arrev(ar,n)     reverse(ar,ar+n)
#define              pb              push_back
#define              popb            pop_back
#define              booster()       ios_base::sync_with_stdio(0); cin.tie(0);
#define              read(f)         freopen(f, "r", stdin)
#define              scani(x)        scanf("%d",&x)
#define              scanl(x)        scanf("%I64d",&x)
#define              scand(x)        scanf("%lf",&x)
#define              scans(x)        scanf("%s",x)
#define              OUT(x)          printf("%d\n",x)
#define              OUTS(x)         printf("%d ",x)
#define              min3(a,b,c)     min(a,min(b,c))
#define              max3(a,b,c)     max(a,max(b,c))
#define              min4(a,b,c,d)   min(min(a,b),min(c,d))
#define              max4(a,b,c,d)   max(max(a,b),max(c,d))
#define              max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define              min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))

#define              bitCheck(a,k)     ((bool)(a&(1<<(k))))
#define              bitOff(a,k)       (a&(~(1<<(k))))
#define              bitOn(a,k)        (a|(1<<(k)))
#define              bitFlip(a,k)      (a^(1<<(k)))

#define              POPCOUNT           __builtin_popcount
#define              POPCOUNTLL         __builtin_popcountll
#define              RIGHTMOST          __builtin_ctzll
#define              LEFTMOST(x)        (63-__builtin_clzll((x)))

#define scani2(a,b) scani(a) , scani(b)
#define scani3(a,b,c) scani(a), scani(b), scani(c)
#define scani4(a,b,c,d) scani(a), scani(b), scani(c), scani(d)
#define scani5(a,b,c,d,e) scani(a), scani(b), scani(c), scani(d) , scani(e)
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*********************Ordered Multiset*************************/

/*** Needs C++11 or C++14 ***/
/// Treap supporting duplicating values in set
/// Maximum value of treap * ADD must fit in long long

/*

struct Treap{ /// hash = 96814
    int len;
    const int ADD = 1000010;
    const int MAXVAL = 1000000010;
    tr1::unordered_map <long long, int> mp; /// Change to int if only int in treap
    tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> T;
    Treap(){
        len = 0;
        T.clear(), mp.clear();
    }
    inline void clear(){
        len = 0;
        T.clear(), mp.clear();
    }
    inline void insert(long long x){
        len++, x += MAXVAL;
        int c = mp[x]++;
        T.insert((x * ADD) + c);
    }
    inline void erase(long long x){
        x += MAXVAL;
        int c = mp[x];
        if (c){
            c--, mp[x]--, len--;
            T.erase((x * ADD) + c);
        }
    }
    /// 1-based index, returns the K'th element in the treap, -1 if none exists
    inline long long kth(int k){
        if (k < 1 || k > len) return -1;
        auto it = T.find_by_order(--k);
        return ((*it) / ADD) - MAXVAL;
    }
    /// Count of value < x in treap
    inline int count(long long x){
        x += MAXVAL;
        int c = mp[--x];
        return (T.order_of_key((x * ADD) + c));
    }
    /// Number of elements in treap
    inline int size(){
        return len;
    }
};

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;///*X.find_by_order();X.order_of_key();
template <class T> inline bool isLeap(T y) {return (y % 400 == 0) || (y % 100 ? y % 4 == 0 : false); }*/
template< class T > inline T gcd(T a, T b) { return (b) == 0 ? (a) : gcd((b), ((a) % (b))); }
template< class T > inline T lcm(T a, T b) { return ((a) / gcd((a), (b)) * (b)); }
template <class T> inline T BigMod(T Base,T power,T M=mod){if(power==0)return 1;if(power&1)return ((Base%M)*(BigMod(Base,power-1,M)%M))%M;else{T y=BigMod(Base,power/2,M)%M;return (y*y)%M;}}
template <class T> inline T ModInv (T A,T M = mod){return BigMod(A,M-2,M);}

int fx[] = {-1,+0,+1,+0,+1,+1,-1,-1,+0};
int fy[] = {+0,-1,+0,+1,+1,-1,+1,-1,+0};
int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

/*********************** let the play begin() *********************************/

/// ********** FASTER one *******************///
namespace mf
{
    const int MAXN = 10004;
    struct edge {
        int a, b, cap, flow ;
        edge(int _a,int _b,int _c,int _d) {
            a=_a,b=_b,cap=_c,flow=_d;
        }
    } ;

    int INF=1500000001;

    int n, s, t, d [ MAXN*2 ] , ptr [ MAXN*2 ] , q [ MAXN*2*10 ] ;
    vector < edge > e ;
    vector < int > g [ MAXN * 2 ] ;

    void addEdge ( int a, int b, int cap ,int cap2=0) {
        edge e1 =edge( a, b, cap, 0 ) ; /// forward cap
        edge e2 =edge( b, a, cap2 , 0 ) ; /// backward cap change here if needed
        g [ a ] . push_back ( ( int ) e. size ( ) ) ;
        e. push_back ( e1 ) ;
        g [ b ] . push_back ( ( int ) e. size ( ) ) ;
        e. push_back ( e2 ) ;
    }

    bool bfs ( ) {
        int qh = 0 , qt = 0 ;
        q [ qt ++ ] = s ;
        memset ( d, -1 , sizeof d ) ;
        d [ s ] = 0 ;
        while ( qh < qt && d [ t ] == - 1 ) {
            int v = q [ qh ++ ] ;
            for ( size_t i = 0 ; i < g [ v ] . size ( ) ; ++ i ) {
                int id = g [ v ] [ i ] ,
                    to = e [ id ] . b ;
                if ( d [ to ] == - 1 && e [ id ] . flow < e [ id ] . cap ) {
                    q [ qt ++ ] = to ;
                    d [ to ] = d [ v ] + 1 ;
                }
            }
        }
        return d [ t ] != -1;
    }

    int dfs ( int v, int flow ) {
        if ( ! flow )  return 0 ;
        if ( v == t )  return flow ;
        for ( ; ptr [ v ] < ( int ) g [ v ] . size ( ) ; ++ ptr [ v ] ) {
            int id = g [ v ] [ ptr [ v ] ] ,
                to = e [ id ] . b ;
            if ( d [ to ] != d [ v ] + 1 )  continue ;
            int pushed = dfs ( to, min ( flow, e [ id ] . cap - e [ id ] . flow ) ) ;
            if ( pushed ) {
                e [ id ] . flow += pushed ;
                e [ id ^ 1 ] . flow -= pushed ;
                return pushed ;
            }
        }
        return 0 ;
    }

    ll dinic ( ) {
        ll flow = 0 ;
        for ( ;; ) {
            if ( !bfs () )  break ;
            memset ( ptr, 0 , sizeof ptr ) ;
            while ( int pushed = dfs ( s, INF ) ) {
                flow += (ll)pushed ;
                if(pushed == 0)break;
            }
        }
        return flow ;
    }

    void init(int src, int dest , int nodes){
        e.clear();
        for(int i = 0;i<=n+n;i++) g[i].clear();
        n = nodes; s = src; t = dest;
    }
};

int prime[MAX],p,flag[MAX];
void sieve(int n){
	double z = sqrt(n);
	for(int i = 4;i<=n;i+=2)flag[i] = 1;
	for(int i = 3;i<=z;i+=2){
		if(!flag[i]){
			for(ll j = i*i;j<=n;j+=i+i)flag[j] = 1;
		}
	}
	prime[p++] = 2;
	for(int i = 3;i<=n;i+=2){
		if(!flag[i])prime[p++] = i;
	}
}

int nn,arr[MAX];vi v[MAX],ans[MAX];int vis[MAX],cnt;

void dfs(int s){
	vis[s] = 1;
	ans[cnt].pb(s);
	for(auto it : v[s]){
		if(!vis[it])dfs(it);
	}
}

int main()
{
    booster()
    ///read("input.txt");

    sieve(10000);

    cin>>nn;
    for(int i = 0;i<nn;i++){
		cin>>arr[i];
    }

    mf::init(0,nn+1,nn+3);

    for(int i = 0;i<nn;i++){
		for(int j = i+1;j<nn;j++){
			if(!flag[arr[i]+arr[j]]){
				if(arr[i]&1)mf::addEdge(i+1,j+1,1);
				else mf::addEdge(j+1,i+1,1);
			}
		}
    }
    int pnt = 0;
    for(int i = 0;i<nn;i++){
		if(arr[i]&1)mf::addEdge(0,i+1,2),pnt++;
		else mf::addEdge(i+1,nn+1,2);
    }
    int x = mf::dinic();
	///cout<<x<<endl;
    if(x!=nn||pnt!=nn-pnt)cout<<"Impossible";
    else {
        for(int i = 0;i<nn;i++){
            int sz = mf::g[i+1].size();
            for(int j = 0;j<sz;j++){
				int indx = mf::g[i+1][j];
				if(mf::e[indx].flow==1){
                    int a = mf::e[indx].a;
                    int b = mf::e[indx].b;
                    v[a].pb(b);
                    v[b].pb(a);
				}
            }
        }

		for(int i = 1;i<=nn;i++){
			if(!vis[i]){
				cnt++;
				dfs(i);
			}
		}
		cout<<cnt<<endl;
		for(int i = 1;i<=cnt;i++){
			cout<<ans[i].size()<<" ";
			for(auto it : ans[i])cout<<it<<" ";
			cout<<endl;
		}
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 250 ;
const int INF = 100000000 ;

struct edge {
	int a, b, cap, flow ;
} ;

int n, s, t, d [ MAXN ] , ptr [ MAXN ] , q [ MAXN ] ;
vector < edge > e ;
vector < int > g [ MAXN ] ;

void add_edge ( int a, int b, int cap ) {
	edge e1 = { a, b, cap, 0 } ;
	edge e2 = { b, a, 0 , 0 } ;
	g [ a ].push_back ( ( int ) e. size ( ) ) ;
	e. push_back ( e1 ) ;
	g [ b ].push_back ( ( int ) e. size ( ) ) ;
	e. push_back ( e2 ) ;
}

bool bfs ( ) {
	int qh = 0 , qt = 0 ;
	q [ qt ++ ] = s ;
	memset ( d, - 1 , sizeof d  ) ;
	d [ s ] = 0 ;
	while ( qh < qt && d [ t ] == - 1 ) {
		int v = q [ qh ++ ] ;
		for ( size_t i = 0 ; i < g [ v ] . size ( ) ; ++ i ) {
			int id = g [ v ] [ i ] ,
				to = e [ id ].b ;
			if ( d [ to ] == - 1 && e [ id ] . flow < e [ id ].cap ) {
				q [ qt ++ ] = to ;
				d [ to ] = d [ v ] + 1 ;
			}
		}
	}
	return d [ t ] != - 1 ;
}

int dfs ( int v, int flow ) {
	if ( ! flow )  return 0 ;
	if ( v == t )  return flow ;
	for ( ; ptr [ v ] < ( int ) g [ v ] . size ( ) ; ++ ptr [ v ] ) {
		int id = g [ v ] [ ptr [ v ] ] ,
			to = e [ id ] . b ;
		if ( d [ to ] != d [ v ] + 1 )  continue ;
		int pushed = dfs ( to, min ( flow, e [ id ] . cap - e [ id ] . flow ) ) ;
		if ( pushed ) {
			e [ id ].flow += pushed ;
			e [ id ^ 1 ].flow -= pushed ;
			return pushed ;
		}
	}
	return 0 ;
}

int dinic ( ) {
	int flow = 0 ;
	for ( ;; ) {
		if ( ! bfs ( ) )  break ;
		memset ( ptr, 0 ,sizeof ptr  ) ;
		while ( int pushed = dfs ( s, INF ) )
			flow += pushed ;
	}
	return flow ;
}

vector<int> g2[500];
bool vis_p[500];
vector<vector<int>> ans;
void dfs_print(int s)
{
    ans[ans.size()-1].push_back(s);
    vis_p[s] = true;
    for(int i : g2[s])
        if(!vis_p[i])
        {
            dfs_print(i);
        }
}

bool isprime[50009];
int main()
{
    memset(isprime, -1, sizeof isprime);
    isprime[0] = false;
    isprime[1] = false;
    for (int p=2; p*p<=50000; p++)
    {
        if (isprime[p]){
            for (int i=p*p; i<=50000; i += p)
                isprime[i] = false;
        }
    }

    int n,x;
    scanf("%d",&n);
    vector<pair<int,int>> e,o;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&x);
        if(x&1)
            o.push_back(make_pair(x,i));
        else
            e.push_back(make_pair(x,i));
    }
    if(o.size() != e.size())
    {
        puts("Impossible");
        return 0;
    }
    ::s = 0;
    ::t = 1;
    for(int i=0;i<o.size();i++)
    {
        for(int j=0;j<e.size();j++)
        {
            int u=o[i].first,v=e[j].first;
            if(isprime[u+v])
            {
                add_edge(i+2,2+j+o.size(),1);
            }
        }
    }
    for(int i=2;i<o.size()+2;i++){
        add_edge(::s,i,2);
        add_edge(i+o.size(),::t,2);
    }
    int f = dinic();

    if(f != 2*o.size())
    {
        puts("Impossible");
        return 0;
    }
    int gn = 0;
    for(int i=0;i<::e.size();i++)
    {
        auto ed = ::e[i];
        if(ed.flow==1)
        {
            g2[ed.a].push_back(ed.b);
            g2[ed.b].push_back(ed.a);
            gn = max(gn, ed.b);
        }
    }
    memset(vis_p,0,sizeof vis_p);
    for(int i=2;i<gn+5;i++)
    {
        if(!vis_p[i] && !g2[i].empty()){
            ans.push_back(vector<int>());
            dfs_print(i);
        }
    }
    printf("%d\n",ans.size());
    for(int i=0;i<ans.size();i++)
    {
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();j++)
        {
            x = ans[i][j];
            x-=2;
            if(x < 0)
                continue;
            if(x < o.size())
                x = o[x].second;
            else
                x = e[x-o.size()].second;
            printf("%d ",x+1);
        }
        puts("");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 250 ;
const int INF = 100000000 ;

struct edge {
	int a, b, cap, flow ;
} ;

int n, s, t, d [ MAXN ] , ptr [ MAXN ] , q [ MAXN ] ;
vector < edge > e ;
vector < int > g [ MAXN ] ;

void add_edge ( int a, int b, int cap ) {
	edge e1 = { a, b, cap, 0 } ;
	edge e2 = { b, a, 0 , 0 } ;
	g [ a ].push_back ( ( int ) e. size ( ) ) ;
	e. push_back ( e1 ) ;
	g [ b ].push_back ( ( int ) e. size ( ) ) ;
	e. push_back ( e2 ) ;
}

bool bfs ( ) {
	int qh = 0 , qt = 0 ;
	q [ qt ++ ] = s ;
	memset ( d, - 1 , sizeof d  ) ;
	d [ s ] = 0 ;
	while ( qh < qt && d [ t ] == - 1 ) {
		int v = q [ qh ++ ] ;
		for ( size_t i = 0 ; i < g [ v ] . size ( ) ; ++ i ) {
			int id = g [ v ] [ i ] ,
				to = e [ id ].b ;
			if ( d [ to ] == - 1 && e [ id ] . flow < e [ id ].cap ) {
				q [ qt ++ ] = to ;
				d [ to ] = d [ v ] + 1 ;
			}
		}
	}
	return d [ t ] != - 1 ;
}

int dfs ( int v, int flow ) {
	if ( ! flow )  return 0 ;
	if ( v == t )  return flow ;
	for ( ; ptr [ v ] < ( int ) g [ v ] . size ( ) ; ++ ptr [ v ] ) {
		int id = g [ v ] [ ptr [ v ] ] ,
			to = e [ id ] . b ;
		if ( d [ to ] != d [ v ] + 1 )  continue ;
		int pushed = dfs ( to, min ( flow, e [ id ] . cap - e [ id ] . flow ) ) ;
		if ( pushed ) {
			e [ id ].flow += pushed ;
			e [ id ^ 1 ].flow -= pushed ;
			return pushed ;
		}
	}
	return 0 ;
}

int dinic ( ) {
	int flow = 0 ;
	for ( ;; ) {
		if ( ! bfs ( ) )  break ;
		memset ( ptr, 0 ,sizeof ptr  ) ;
		while ( int pushed = dfs ( s, INF ) )
			flow += pushed ;
	}
	return flow ;
}

vector<int> g2[500];
bool vis_p[500];
vector<vector<int>> ans;
void dfs_print(int s)
{
    ans[ans.size()-1].push_back(s);
    vis_p[s] = true;
    for(int i : g2[s])
        if(!vis_p[i])
        {
            dfs_print(i);
        }
}

bool isprime[30009];
int main()
{
    memset(isprime, -1, sizeof isprime);
    for (int p=2; p*p<=30000; p++)
    {
        if (isprime[p]){
            for (int i=p*p; i<=1e4; i += p)
                isprime[i] = false;
        }
    }
    int n,x;
    scanf("%d",&n);
    vector<pair<int,int>> e,o;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&x);
        if(x&1)
            o.push_back(make_pair(x,i));
        else
            e.push_back(make_pair(x,i));
    }
    if(o.size() != e.size())
    {
        puts("Impossible");
        return 0;
    }
    ::s = 0;
    ::t = 1;
    for(int i=0;i<o.size();i++)
    {
        for(int j=0;j<e.size();j++)
        {
            int u=o[i].first,v=e[j].first;
            if(isprime[u+v])
            {
                add_edge(i+2,2+j+o.size(),1);
            }
        }
    }
    for(int i=2;i<o.size()+2;i++){
        add_edge(::s,i,2);
        add_edge(i+o.size(),::t,2);
    }
    int f = dinic();
    int gn = 0;
    for(int i=0;i<::e.size();i++)
    {
        auto ed = ::e[i];
        if(ed.flow==1)
        {
            g2[ed.a].push_back(ed.b);
            g2[ed.b].push_back(ed.a);
            gn = max(gn, ed.b);
        }
    }
    if(f != 2*o.size())
    {
        puts("Impossible");
        return 0;
    }
    memset(vis_p,0,sizeof vis_p);
    for(int i=2;i<gn+5;i++)
    {
        if(!vis_p[i] && !g2[i].empty()){
            ans.push_back(vector<int>());
            dfs_print(i);
        }
    }
    printf("%d\n",ans.size());
    for(int i=0;i<ans.size();i++)
    {
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();j++)
        {
            x = ans[i][j];
            x-=2;
            if(x < 0)
                continue;
            if(x < o.size())
                x = o[x].second;
            else
                x = e[x-o.size()].second;
            printf("%d ",x+1);
        }
        puts("");
    }
    return 0;
}


#include <stdio.h>
#include <vector>

#define pb push_back

using namespace std;

struct edge {
   int to, f, c;
};

vector <edge> edges;

vector <int> graph[505];

vector <int> bond[505];

vector <int> cycles[505];

int lvl[505], ptr[505], q[505];

bool isP[20005];

int arr[505], n, v0, v1 = 500;

bool u[505];

inline void add_edge (int v, int to, int c){
   graph[v].pb (edges.size ());
   edges.pb ({to, 0, c});

   graph[to].pb (edges.size ());
   edges.pb ({v, 0, 0});
}

inline bool bfs (){
   for (int i = v0; i <= v1; ++ i){
      lvl[i] = 0;
   }

   lvl[v0] = 1;

   int l = 0, r = 0;
   q[++ r] = v0;

   while (l < r){
      int v = q[++ l];

      for (int i = 0, id, to; i < graph[v].size (); ++ i){
         id = graph[v][i];
         to = edges[id].to;

         if (edges[id].f < edges[id].c && !lvl[to]){
            lvl[to] = lvl[v] + 1;
            q[++ r] = to;
         }
      }
   }

   return lvl[v1];
}

int dfs (int v, int flow){
   if (v == v1 || !flow){
      return flow;
   }

   for (int id, to, f, c; ptr[v] < graph[v].size (); ++ ptr[v]){
      id = graph[v][ptr[v]];

      to = edges[id].to;
      f = edges[id].f;
      c = edges[id].c;

      if (lvl[to] != lvl[v] + 1){
         continue;
      }

      int pushed = dfs (to, (flow < c - f ? flow : c - f));

      if (pushed > 0){
         edges[id].f += pushed;
         edges[id ^ 1].f -= pushed;

         return pushed;
      }
   }

   return 0;
}

void calc (int v, int id){
   u[v] = 1;
   cycles[id].pb (v);

   for (int i = 0, to; i < bond[v].size (); ++ i){
      to = bond[v][i];

      if (!u[to]){
         calc (to, id);
      }
   }
}

int main (){
   int res = 0;
   scanf ("%d", &n);

   for (int i = 1; i <= n; ++ i){
      scanf ("%d", &arr[i]);
   }

   for (int i = 2; i <= 20000; ++ i){
      isP[i] = 1;
   }

   for (int i = 2; i * i <= 20000; ++ i){
      if (isP[i]){
         for (int j = i * i; j <= 20000; j += i){
            isP[j] = 0;
         }
      }
   }

   for (int i = 1; i <= n; ++ i){
      add_edge (v0, i, 2);
      add_edge (n + i, v1, 2);
   }

   for (int i = 1; i <= n; ++ i){
      for (int j = i + 1; j <= n; ++ j){
         if (isP[arr[i] + arr[j]]){
            add_edge (i, n + j, 1);
            add_edge (j, n + i, 1);
         }
      }
   }

   while (bfs ()){
      for (int i = v0; i <= v1; ++ i){
         ptr[i] = 0;
      }

      while (int pushed = dfs (v0, 10000)){
         res += pushed;
      }
   }

   if (res != n + n){
      printf ("Impossible");
   }
   else {
      int cnt = 0;

      for (int i = 1; i <= n; ++ i){
         for (int j = 0; j < graph[i].size (); ++ j){
            if (edges[graph[i][j]].f == edges[graph[i][j]].c){
               bond[i].pb (edges[graph[i][j]].to - n);
            }
         }
      }

      for (int i = 1; i <= n; ++ i){
         if (!u[i]){
            calc (i, cnt ++);
         }
      }

      printf ("%d\n", cnt);

      for (int i = 0; i < cnt; ++ i){
         printf ("%d ", cycles[i].size ());

         for (int j = 0; j < cycles[i].size (); ++ j){
            printf ("%d ", cycles[i][j]);
         }

         printf ("\n");
      }

   }

   return 0;
}


#include <stdio.h>
#include <vector>

#define pb push_back

using namespace std;

struct edge {
   int to, f, c;
};

vector <edge> edges;

vector <int> graph[505];

vector <int> bond[505];

vector <int> cycles[505];

int lvl[505], ptr[505], q[505];

bool isP[20005];

int arr[505], n, v0, v1 = 500;

bool u[505];

inline void add_edge (int v, int to, int c){
   graph[v].pb (edges.size ());
   edges.pb ({to, 0, c});

   graph[to].pb (edges.size ());
   edges.pb ({v, 0, 0});
}

inline bool bfs (){
   for (int i = v0; i <= v1; ++ i){
      lvl[i] = 0;
   }

   lvl[v0] = 1;

   int l = 0, r = 0;
   q[++ r] = v0;

   while (l < r){
      int v = q[++ l];

      for (int i = 0, id, to; i < graph[v].size (); ++ i){
         id = graph[v][i];
         to = edges[id].to;

         if (edges[id].f < edges[id].c && !lvl[to]){
            lvl[to] = lvl[v] + 1;
            q[++ r] = to;
         }
      }
   }

   return lvl[v1];
}

int dfs (int v, int flow){
   if (v == v1 || !flow){
      return flow;
   }

   for (int id, to, f, c; ptr[v] < graph[v].size (); ++ ptr[v]){
      id = graph[v][ptr[v]];

      to = edges[id].to;
      f = edges[id].f;
      c = edges[id].c;

      if (lvl[to] != lvl[v] + 1){
         continue;
      }

      int pushed = dfs (to, (flow < c - f ? flow : c - f));

      if (pushed > 0){
         edges[id].f += pushed;
         edges[id ^ 1].f -= pushed;

         return pushed;
      }
   }

   return 0;
}

void calc (int v, int id){
   u[v] = 1;
   cycles[id].pb (v);

   for (int i = 0, to; i < bond[v].size (); ++ i){
      to = bond[v][i];

      if (!u[to]){
         calc (to, id);
      }
   }
}

int main (){
   int res = 0;
   scanf ("%d", &n);

   for (int i = 1; i <= n; ++ i){
      scanf ("%d", &arr[i]);
   }

   for (int i = 2; i <= 20000; ++ i){
      isP[i] = 1;
   }

   for (int i = 2; i * i <= 20000; ++ i){
      if (isP[i]){
         for (int j = i * i; j <= 20000; j += i){
            isP[j] = 0;
         }
      }
   }

   for (int i = 1; i <= n; ++ i){
      add_edge (v0, i, 2);
      add_edge (n + i, v1, 2);
   }

   for (int i = 1; i <= n; ++ i){
      for (int j = i + 1; j <= n; ++ j){
         if (isP[arr[i] + arr[j]]){
            add_edge (i, n + j, 1);
            add_edge (j, n + i, 1);
         }
      }
   }

   while (bfs ()){
      for (int i = v0; i <= v1; ++ i){
         ptr[i] = 0;
      }

      while (int pushed = dfs (v0, 1000)){
         res += pushed;
      }
   }

   if (res != n + n){
      printf ("Impossible");
   }
   else {
      int cnt = 0;

      for (int i = 1; i <= n; ++ i){
         for (int j = 0; j < graph[i].size (); ++ j){
            if (edges[graph[i][j]].f == edges[graph[i][j]].c){
               bond[i].pb (edges[graph[i][j]].to - n);
            }
         }
      }

      for (int i = 1; i <= n; ++ i){
         if (!u[i]){
            calc (i, cnt ++);
         }
      }

      printf ("%d\n", cnt);

      for (int i = 0; i < cnt; ++ i){
         printf ("%d ", cycles[i].size ());

         for (int j = 0; j < cycles[i].size (); ++ j){
            printf ("%d ", cycles[i][j]);
         }

         printf ("\n");
      }

   }

   return 0;
}


#include <stdio.h>
#include <vector>

#define pb push_back

using namespace std;

struct edge {
   int to, f, c;
};

vector <edge> edges;

vector <int> graph[505];

vector <int> bond[505];

vector <int> cycles[505];

int lvl[505], ptr[505], q[505];

bool isP[20005];

int arr[505], n, v0, v1 = 500;

bool u[505], goes[505][505];

inline void add_edge (int v, int to, int c){
   graph[v].pb (edges.size ());
   edges.pb ({to, 0, c});

   graph[to].pb (edges.size ());
   edges.pb ({v, 0, 0});
}

inline bool bfs (){
   for (int i = v0; i <= v1; ++ i){
      lvl[i] = 0;
   }

   lvl[v0] = 1;

   int l = 0, r = 0;
   q[++ r] = v0;

   while (l < r){
      int v = q[++ l];

      for (int i = 0, id, to; i < graph[v].size (); ++ i){
         id = graph[v][i];
         to = edges[id].to;

         if (edges[id].f < edges[id].c && !lvl[to]){
            lvl[to] = lvl[v] + 1;
            q[++ r] = to;
         }
      }
   }

   return lvl[v1];
}

int dfs (int v, int flow){
   if (v == v1 || !flow){
      return flow;
   }

   for (int id, to, f, c; ptr[v] < graph[v].size (); ++ ptr[v]){
      id = graph[v][ptr[v]];

      to = edges[id].to;
      f = edges[id].f;
      c = edges[id].c;

      if (lvl[to] != lvl[v] + 1){
         continue;
      }

      int pushed = dfs (to, (flow < c - f ? flow : c - f));

      if (pushed > 0){
         edges[id].f += pushed;
         edges[id ^ 1].f -= pushed;

         if (v != v0 && to != v1){
            if (v < to){
               goes[v][to - n] = 1;
            }
            else {
               goes[to][v - n] = 0;
            }
         }

         return pushed;
      }
   }

   return 0;
}

void calc (int v, int id){
   u[v] = 1;
   cycles[id].pb (v);

   for (int i = 0, to; i < bond[v].size (); ++ i){
      to = bond[v][i];

      if (!u[to]){
         calc (to, id);
      }
   }
}

int main (){
   int res = 0;
   scanf ("%d", &n);

   for (int i = 1; i <= n; ++ i){
      scanf ("%d", &arr[i]);
   }

   for (int i = 2; i <= 20000; ++ i){
      isP[i] = 1;
   }

   for (int i = 2; i * i <= 20000; ++ i){
      if (isP[i]){
         for (int j = i * i; j <= 20000; j += i){
            isP[j] = 0;
         }
      }
   }

   for (int i = 1; i <= n; ++ i){
      add_edge (v0, i, 2);
      add_edge (n + i, v1, 2);
   }

   for (int i = 1; i <= n; ++ i){
      for (int j = i + 1; j <= n; ++ j){
         if (isP[arr[i] + arr[j]]){
            add_edge (i, n + j, 1);
            add_edge (j, n + i, 1);
         }
      }
   }

   while (bfs ()){
      for (int i = v0; i <= v1; ++ i){
         ptr[i] = 0;
      }

      while (int pushed = dfs (v0, 1000)){
         res += pushed;
      }
   }

   if (res != n + n){
      printf ("Impossible");
   }
   else {
      int cnt = 0;

      for (int i = 1; i <= n; ++ i){
         for (int j = 1; j <= n; ++ j){
            if (goes[i][j]){
               bond[i].pb (j);
            }
         }
      }

      for (int i = 1; i <= n; ++ i){
         if (!u[i]){
            calc (i, cnt ++);
         }
      }

      printf ("%d\n", cnt);

      for (int i = 0; i < cnt; ++ i){
         printf ("%d ", cycles[i].size ());

         for (int j = 0; j < cycles[i].size (); ++ j){
            printf ("%d ", cycles[i][j]);
         }

         printf ("\n");
      }

   }

   return 0;
}


#include <stdio.h>
#include <vector>

#define pb push_back

using namespace std;

struct edge {
   int to, f, c;
};

vector <edge> edges;

vector <int> graph[505];

vector <int> bond[505];

vector <int> cycles[505];

int lvl[505], ptr[505], q[505];

bool isP[20005];

int arr[505], n, v0, v1 = 500;

bool u[505];

inline void add_edge (int v, int to, int c){
   graph[v].pb (edges.size ());
   edges.pb ({to, 0, c});

   graph[to].pb (edges.size ());
   edges.pb ({v, 0, 0});
}

inline bool bfs (){
   for (int i = v0; i <= v1; ++ i){
      lvl[i] = 0;
   }

   lvl[v0] = 1;

   int l = 0, r = 0;
   q[++ r] = v0;

   while (l < r){
      int v = q[++ l];

      for (int i = 0, id, to; i < graph[v].size (); ++ i){
         id = graph[v][i];
         to = edges[id].to;

         if (edges[id].f < edges[id].c && !lvl[to]){
            lvl[to] = lvl[v] + 1;
            q[++ r] = to;
         }
      }
   }

   return lvl[v1];
}

int dfs (int v, int flow){
   if (v == v1 || !flow){
      return flow;
   }

   for (int id, to, f, c; ptr[v] < graph[v].size (); ++ ptr[v]){
      id = graph[v][ptr[v]];

      to = edges[id].to;
      f = edges[id].f;
      c = edges[id].c;

      if (lvl[to] != lvl[v] + 1){
         continue;
      }

      int pushed = dfs (to, (flow < c - f ? flow : c - f));

      if (pushed > 0){
         edges[id].f += pushed;
         edges[id ^ 1].f -= pushed;

         if (v != v0 && to != v1){
            bond[v].pb (to - n);
         }

         return pushed;
      }
   }

   return 0;
}

void calc (int v, int id){
   u[v] = 1;
   cycles[id].pb (v);

   for (int i = 0, to; i < bond[v].size (); ++ i){
      to = bond[v][i];

      if (!u[to]){
         calc (to, id);
      }
   }
}

int main (){
   int res = 0;
   scanf ("%d", &n);

   for (int i = 1; i <= n; ++ i){
      scanf ("%d", &arr[i]);
   }

   for (int i = 2; i <= 20000; ++ i){
      isP[i] = 1;
   }

   for (int i = 2; i * i <= 20000; ++ i){
      if (isP[i]){
         for (int j = i * i; j <= 20000; j += i){
            isP[j] = 0;
         }
      }
   }

   for (int i = 1; i <= n; ++ i){
      add_edge (v0, i, 2);
      add_edge (n + i, v1, 2);
   }

   for (int i = 1; i <= n; ++ i){
      for (int j = i + 1; j <= n; ++ j){
         if (isP[arr[i] + arr[j]]){
            add_edge (i, n + j, 1);
            add_edge (j, n + i, 1);
         }
      }
   }

   while (bfs ()){
      for (int i = v0; i <= v1; ++ i){
         ptr[i] = 0;
      }

      while (int pushed = dfs (v0, 1000)){
         res += pushed;
      }
   }

   if (res != n + n){
      printf ("Impossible");
   }
   else {
      int cnt = 0;

      for (int i = 1; i <= n; ++ i){
         if (!u[i]){
            calc (i, cnt ++);
         }
      }

      printf ("%d\n", cnt);

      for (int i = 0; i < cnt; ++ i){
         printf ("%d ", cycles[i].size ());

         for (int j = 0; j < cycles[i].size (); ++ j){
            printf ("%d ", cycles[i][j]);
         }

         printf ("\n");
      }
   }

   return 0;
}


#include <stdio.h>
#include <vector>

#define pb push_back

using namespace std;

struct edge {
   int to, f, c;
};

vector <edge> edges;

vector <int> graph[505];

vector <int> bond[505];

vector <int> cycles[505];

int lvl[505], ptr[505], q[505];

bool isP[20005];

int arr[205], n, v0, v1 = 500;

bool u[205];

inline void add_edge (int v, int to, int c){
   graph[v].pb (edges.size ());
   edges.pb ({to, 0, c});

   graph[to].pb (edges.size ());
   edges.pb ({v, 0, 0});
}

inline bool bfs (){
   for (int i = v0; i <= v1; ++ i){
      lvl[i] = 0;
   }

   lvl[v0] = 1;

   int l = 0, r = 0;
   q[++ r] = v0;

   while (l < r){
      int v = q[++ l];

      for (int i = 0, id, to; i < graph[v].size (); ++ i){
         id = graph[v][i];
         to = edges[id].to;

         if (edges[id].f < edges[id].c && !lvl[to]){
            lvl[to] = lvl[v] + 1;
            q[++ r] = to;
         }
      }
   }

   return lvl[v1];
}

int dfs (int v, int flow){
   if (v == v1 || !flow){
      return flow;
   }

   for (int id, to, f, c; ptr[v] < graph[v].size (); ++ ptr[v]){
      id = graph[v][ptr[v]];

      to = edges[id].to;
      f = edges[id].f;
      c = edges[id].c;

      if (lvl[to] != lvl[v] + 1){
         continue;
      }

      int pushed = dfs (to, (flow < c - f ? flow : c - f));

      if (pushed > 0){
         edges[id].f += pushed;
         edges[id ^ 1].f -= pushed;

         if (v != v0 && to != v1){
            if (v < to){
               bond[v].pb (to - n);
            }
            else {
               for (int j = 0; j < bond[to].size (); ++ j){
                  if (bond[to][j] == v - n){
                     bond[to].erase (bond[to].begin () + j);
                     break;
                  }
               }
            }
         }

         return pushed;
      }
   }

   return 0;
}

void calc (int v, int id){
   u[v] = 1;
   cycles[id].pb (v);

   for (int i = 0, to; i < bond[v].size (); ++ i){
      to = bond[v][i];

      if (!u[to]){
         calc (to, id);
      }
   }
}

int main (){
   int res = 0;
   scanf ("%d", &n);

   for (int i = 1; i <= n; ++ i){
      scanf ("%d", &arr[i]);
   }

   for (int i = 2; i <= 20000; ++ i){
      isP[i] = 1;
   }

   for (int i = 2; i * i <= 20000; ++ i){
      if (isP[i]){
         for (int j = i * i; j <= 20000; j += i){
            isP[j] = 0;
         }
      }
   }

   for (int i = 1; i <= n; ++ i){
      add_edge (v0, i, 2);
      add_edge (n + i, v1, 2);
   }

   for (int i = 1; i <= n; ++ i){
      for (int j = i + 1; j <= n; ++ j){
         if (isP[arr[i] + arr[j]]){
            add_edge (i, n + j, 1);
            add_edge (j, n + i, 1);
         }
      }
   }

   while (bfs ()){
      for (int i = v0; i <= v1; ++ i){
         ptr[i] = 0;
      }

      while (int pushed = dfs (v0, 1000)){
         res += pushed;
      }
   }

   if (res != n + n){
      printf ("Impossible");
   }
   else {
      int cnt = 0;

      for (int i = 1; i <= n; ++ i){
         if (!u[i]){
            calc (i, cnt ++);
         }
      }

      printf ("%d\n", cnt);

      for (int i = 0; i < cnt; ++ i){
         printf ("%d ", cycles[i].size ());

         for (int j = 0; j < cycles[i].size (); ++ j){
            printf ("%d ", cycles[i][j]);
         }

         printf ("\n");
      }

   }

   return 0;
}


#include <stdio.h>
#include <vector>

#define pb push_back

using namespace std;

struct edge {
   int to, f, c;
};

vector <edge> e;

vector <int> g1[305], g2[305], g3[305];

vector <int> cycles[205];

int lvl[305], ptr[305], q[305];

int v0, v1 = 250;

int arr[205], color[205];

bool u[205];

inline void add_edge (int v, int to, int c){
   g1[v].pb (e.size ());
   e.pb ({to, 0, c});

   g1[to].pb (e.size ());
   e.pb ({v, 0, 0});
}

inline bool exist (){
   for (int i = v0; i <= v1; ++ i){
      lvl[i] = 0;
   }

   lvl[v0] = 1;

   int l = 0, r = 0;
   q[++ r] = v0;

   while (l < r){
      int v = q[++ l];

      for (int i = 0, id, to; i < g1[v].size (); ++ i){
         id = g1[v][i];
         to = e[id].to;

         if (e[id].f < e[id].c && !lvl[to]){
            lvl[to] = lvl[v] + 1;
            q[++ r] = to;
         }
      }
   }

   return lvl[v1];
}

int dinic (int v, int flow){
   if (v == v1 || !flow){
      return flow;
   }

   for (int id, to, f, c; ptr[v] < g1[v].size (); ++ ptr[v]){
      id = g1[v][ptr[v]];

      to = e[id].to;
      f = e[id].f;
      c = e[id].c;

      if (lvl[to] != lvl[v] + 1){
         continue;
      }

      int pushed = dinic (to, (flow < c - f ? flow : c - f));

      if (pushed > 0){
         e[id].f += pushed;
         e[id ^ 1].f -= pushed;

         return pushed;
      }
   }

   return 0;
}

inline int max_flow (){
   int res = 0;

   while (exist ()){
      for (int i = v0; i <= v1; ++ i){
         ptr[i] = 0;
      }

      while (int pushed = dinic (v0, 10000)){
         res += pushed;
      }
   }

   return res;
}

inline void precalc (int n){
   vector <char> isP (20005, 0);

   for (int i = 2; i <= 20000; ++ i){
      isP[i] = 1;
   }

   for (int i = 2; i * i <= 20000; ++ i){
      if (isP[i]){
         for (int j = i * i; j <= 20000; j += i){
            isP[j] = 0;
         }
      }
   }

   for (int i = 1; i <= n; ++ i){
      for (int j = i + 1; j <= n; ++ j){
         if (isP[arr[i] + arr[j]]){
            g2[i].pb (j);
            g2[j].pb (i);
         }
      }
   }
}

bool pre_dfs (int v, int k){
   color[v] = k + 1;

   for (int i = 0, to; i < g2[v].size (); ++ i){
      to = g2[v][i];

      if (!color[to]){
         if (!pre_dfs (to, k ^ 1)){
            return 0;
         }
      }
      else {
         if (color[to] != (k ^ 1) + 1){
            return 0;
         }
      }
   }

   return 1;
}

inline void prepare (int n){
   for (int i = 1; i <= n; ++ i){
      if (color[i] == 1){
         add_edge (i, v1, 2);
      }
      else {
         add_edge (v0, i, 2);

         for (int j = 0; j < g2[i].size (); ++ j){
            add_edge (i, g2[i][j], 1);
         }
      }
   }
}

void dfs (int v, int id){
   cycles[id].pb (v);
   u[v] = 1;

   for (int i = 0, to; i < g3[v].size (); ++ i){
      to = g3[v][i];

      if (!u[to]){
         dfs (to, id);
      }
   }
}

int main (){
   int n;
   scanf ("%d", &n);

   for (int i = 1; i <= n; ++ i){
      scanf ("%d", &arr[i]);
   }

   precalc (n);

   for (int i = 1; i <= n; ++ i){
      if (!color[i]){
         if (!pre_dfs (i, 1)){
            printf ("Impossible");
            return 0;
         }
      }
   }

   prepare (n);

   if (max_flow () != n){
      printf ("Impossible");
   }
   else {
      for (int i = 1; i <= n; ++ i){
         if (color[i] == 2){
            for (int j = 0; j < g1[i].size (); ++ j){
               if (e[g1[i][j]].f == e[g1[i][j]].c){
                  g3[i].pb (e[g1[i][j]].to);
                  g3[e[g1[i][j]].to].pb (i);
               }
            }
         }
      }

      int cnt = 0;

      for (int i = 1; i <= n; ++ i){
         if (!u[i]){
            dfs (i, cnt ++);
         }
      }

      printf ("%d\n", cnt);

      for (int i = 0; i < cnt; ++ i){
         printf ("%d ", cycles[i].size ());

         for (int j = 0; j < cycles[i].size (); ++ j){
            printf ("%d ", cycles[i][j]);
         }

         printf ("\n");
      }
   }

   return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>

#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a)		cerr<<#a<<" : "<<a<<endl;
#else
#define tr(a)
#endif

#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
#define next 		next1
int edge[300][300];
int next[300];
int next2[300];
int alpha;
int dfsflow(int u,int v){
	queue<pii>q;
	vi P(alpha,-1);
	P[u]=-2;
	q.push(mp(u,INT_MAX));
	int ans=0;
	while(!q.empty()){
		auto cur=q.front();
		if(cur.F==v){
			ans=cur.S;
			break;
		}
		q.pop();
		rep(i,0,alpha){
			if(edge[cur.F][i] and P[i]==-1){
				P[i]=cur.F;
				q.push(mp(i,min(cur.S,edge[cur.F][i])));
			}
		}
	}
	if(P[v]==-1)return 0;
	int cur=v;
	while(cur){
		edge[cur][P[cur]]+=ans;
		edge[P[cur]][cur]-=ans;
		cur=P[cur];
	}
	return ans;
}
bool isPrime(ll N) {
	if(N<2)return false;
	if(N<4)return true;
	if((N&1)==0)return false;
	if(N%3==0)return false;
	ll curr=5;
	while (curr<=sqrt(N)){
		if(N%curr==0)return false;
		curr+=2;
		if(N%curr==0)return false;
		curr+=4;
	}
	return true;
}
void solve(){
	int n;
	cin>>n;
	alpha=n+5;
	vi x(n);
	rep(i,0,n)cin>>x[i];
	vi even,odd;
	rep(i,0,n){
		if(x[i]%2)odd.pb(i);
		else even.pb(i);
	}
	if(sz(odd)!=sz(even)){
		cout<<"Impossible\n";
		return;
	}
	tr(odd)
	tr(even)
	rep(i,0,n/2){
		rep(j,0,n/2){
			if(isPrime(x[odd[i]]+x[even[j]])){
				edge[1+i][1+n/2+j]=1;
			}
		}
	}
	rep(i,1,n/2+1)edge[0][i]=1,edge[n/2+i][n+1]=1;
	int flow=0;
	while(true){
		int ans=dfsflow(0,n+1);
		if(ans)flow+=ans;
		else break;
	}
	if(flow!=n/2){
		cout<<"Impossible\n";
		return;
	}

	rep(i,n/2+1,n+1){
		rep(j,1,n/2+1){
			if(edge[i][j])next[j]=i-n/2;
		}
	}
	memset(edge,0,sizeof edge);
	rep(i,0,n/2){
		rep(j,0,n/2){
			if(isPrime(x[even[i]]+x[odd[j]]) and next[j+1]!=i+1){
				edge[1+i][1+n/2+j]=1;
			}
		}
	}
	rep(i,1,n/2+1)edge[0][i]=1,edge[n/2+i][n+1]=1;
	flow=0;
	while(true){
		int ans=dfsflow(0,n+1);
		if(ans)flow+=ans;
		else break;
	}
	if(flow!=n/2){
		cout<<"Impossible\n";
		return;
	}
	rep(i,n/2+1,n+1){
		rep(j,1,n/2+1){
			if(edge[i][j])next2[j]=i-n/2;
		}
	}
	vector<bool>vis(n+1);
	vector<vi>finans;
	rep(i,1,n/2+1){
		if(vis[odd[i-1]+1])continue;
		pii cur=mp(i,0);
		vi ans;
		do{
			if(!cur.S)ans.pb(odd[cur.F-1]+1),cur=mp(next[cur.F],1),vis[odd[cur.F-1]+1]=1;
			else ans.pb(even[cur.F-1]+1),cur=mp(next2[cur.F],0);
		}while(cur!=mp(i,0));
		finans.pb(ans);
	}
	cout<<sz(finans)<<endl;
	for(auto& i:finans){
		cout<<sz(i)<<" ";
		for(auto j:i)cout<<j<<" ";
		cout<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>

#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a)		cerr<<#a<<" : "<<a<<endl;
#else
#define tr(a)
#endif

#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
#define next 		next1
int edge[300][300];
int next[300];
int next2[300];
int alpha;
int dfsflow(int u,int v){
	queue<pii>q;
	vi P(alpha,-1);
	P[u]=-2;
	q.push(mp(u,INT_MAX));
	int ans=0;
	while(!q.empty()){
		auto cur=q.front();
		if(cur.F==v){
			ans=cur.S;
			break;
		}
		q.pop();
		rep(i,0,alpha){
			if(edge[cur.F][i] and P[i]==-1){
				P[i]=cur.F;
				q.push(mp(i,min(cur.S,edge[cur.F][i])));
			}
		}
	}
	if(P[v]==-1)return 0;
	int cur=v;
	while(cur){
		edge[cur][P[cur]]+=ans;
		edge[P[cur]][cur]-=ans;
		cur=P[cur];
	}
	return ans;
}
bool isPrime(ll N) {
	if(N<2)return false;
	if(N<4)return true;
	if((N&1)==0)return false;
	if(N%3==0)return false;
	ll curr=5;
	while (curr<=sqrt(N)){
		if(N%curr==0)return false;
		curr+=2;
		if(N%curr==0)return false;
		curr+=4;
	}
	return true;
}
void solve(){
	int n;
	cin>>n;
	alpha=n+5;
	vi x(n);
	rep(i,0,n)cin>>x[i];
	vi even,odd;
	rep(i,0,n){
		if(x[i]%2)odd.pb(i);
		else even.pb(i);
	}
	if(sz(odd)!=sz(even)){
		cout<<"Impossible\n";
		return;
	}
	tr(odd)
	tr(even)
	rep(i,0,n/2){
		rep(j,0,n/2){
			if(isPrime(x[odd[i]]+x[even[j]])){
				edge[1+i][1+n/2+j]=1;
			}
		}
	}
	rep(i,1,n/2+1)edge[0][i]=1,edge[n/2+i][n+1]=1;
	int flow=0;
	while(true){
		int ans=dfsflow(0,n+1);
		if(ans)flow+=ans;
		else break;
	}
	if(flow!=n/2){
		cout<<"Impossible\n";
		return;
	}

	rep(i,n/2+1,n+1){
		rep(j,1,n/2+1){
			if(edge[i][j])next[i-n/2]=j;
		}
	}
	memset(edge,0,sizeof edge);
	rep(i,0,n/2){
		rep(j,0,n/2){
			if(isPrime(x[even[i]]+x[odd[j]]) and next[j+1]!=i+1){
				edge[1+i][1+n/2+j]=1;
			}
		}
	}
	rep(i,1,n/2+1)edge[0][i]=1,edge[n/2+i][n+1]=1;
	flow=0;
	while(true){
		int ans=dfsflow(0,n+1);
		if(ans)flow+=ans;
		else break;
	}
	if(flow!=n/2){
		cout<<"Impossible\n";
		return;
	}
	rep(i,n/2+1,n+1){
		rep(j,1,n/2+1){
			if(edge[i][j])next2[i-n/2]=j;
		}
	}
	vector<bool>vis(n+1);
	vector<vi>finans;
	rep(i,1,n/2+1){
		if(vis[odd[i-1]+1])continue;
		pii cur=mp(i,0);
		vi ans;
		do{
			if(!cur.S)ans.pb(odd[cur.F-1]+1),cur=mp(next[cur.F],1),vis[odd[cur.F-1]+1]=1;
			else ans.pb(even[cur.F-1]+1),cur=mp(next2[cur.F],0);
		}while(cur!=mp(i,0));
		finans.pb(ans);
	}
	cout<<sz(finans)<<endl;
	for(auto& i:finans){
		cout<<sz(i)<<" ";
		for(auto j:i)cout<<j<<" ";
		cout<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>

#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a)		cerr<<#a<<" : "<<a<<endl;
#else
#define tr(a)
#endif

#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
#define next 		next1
int edge[300][300];
int next[300];
int next2[300];
int alpha;
int dfsflow(int u,int v){
	queue<pii>q;
	vi P(alpha,-1);
	P[u]=-2;
	q.push(mp(u,INT_MAX));
	int ans=0;
	while(!q.empty()){
		auto cur=q.front();
		if(cur.F==v){
			ans=cur.S;
			break;
		}
		q.pop();
		rep(i,0,alpha){
			if(edge[cur.F][i] and P[i]==-1){
				P[i]=cur.F;
				q.push(mp(i,min(cur.S,edge[cur.F][i])));
			}
		}
	}
	if(P[v]==-1)return 0;
	int cur=v;
	while(cur){
		edge[cur][P[cur]]+=ans;
		edge[P[cur]][cur]-=ans;
		cur=P[cur];
	}
	return ans;
}
bool isPrime(ll N) {
	if(N<2)return false;
	if(N<4)return true;
	if((N&1)==0)return false;
	if(N%3==0)return false;
	ll curr=5;
	while (curr<=sqrt(N)){
		if(N%curr==0)return false;
		curr+=2;
		if(N%curr==0)return false;
		curr+=4;
	}
	return true;
}
void solve(){
	int n;
	cin>>n;
	alpha=n+5;
	vi x(n);
	rep(i,0,n)cin>>x[i];
	vi even,odd;
	rep(i,0,n){
		if(x[i]%2)odd.pb(i);
		else even.pb(i);
	}
	if(sz(odd)!=sz(even)){
		cout<<"Impossible\n";
		return;
	}
	tr(odd)
	tr(even)
	rep(i,0,n/2){
		rep(j,0,n/2){
			if(isPrime(x[odd[i]]+x[even[j]])){
				edge[1+i][1+n/2+j]=1;
			}
		}
	}
	rep(i,1,n/2+1)edge[0][i]=1,edge[n/2+i][n+1]=1;
	int flow=0;
	while(true){
		int ans=dfsflow(0,n+1);
		if(ans)flow+=ans;
		else break;
	}
	if(flow!=n/2){
		cout<<"Impossible\n";
		return;
	}

	rep(i,n/2+1,n+1){
		rep(j,1,n/2+1){
			if(edge[i][j])next[j]=i-n/2;
		}
	}
	memset(edge,0,sizeof edge);
	rep(i,0,n/2){
		rep(j,0,n/2){
			if(isPrime(x[even[i]]+x[odd[j]]) and next[j+1]!=i+1){
				edge[1+i][1+n/2+j]=1;
			}
		}
	}
	rep(i,1,n/2+1)edge[0][i]=1,edge[n/2+i][n+1]=1;
	flow=0;
	while(true){
		int ans=dfsflow(0,n+1);
		if(ans)flow+=ans;
		else break;
	}
	if(flow!=n/2){
		cout<<"Impossible\n";
		return;
	}
	rep(i,n/2+1,n+1){
		rep(j,1,n/2+1){
			if(edge[i][j])next2[j]=i-n/2;
		}
	}

	vector<bool>vis(n+1);
	vector<vi>finans;
	rep(i,1,n/2+1){
		if(vis[i])continue;
		pii cur=mp(i,0);
		vi ans;
		do{
			if(!cur.S)ans.pb(odd[cur.F-1]+1),vis[cur.F]=1,cur=mp(next[cur.F],1);
			else ans.pb(even[cur.F-1]+1),cur=mp(next2[cur.F],0);
		}while(cur!=mp(i,0));
		finans.pb(ans);
		tr(vis)
	}
	cout<<sz(finans)<<endl;
	for(auto& i:finans){
		cout<<sz(i)<<" ";
		for(auto j:i)cout<<j<<" ";
		cout<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#define pb push_back
using namespace std;
int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector <char> A, F, I;
    int c = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'A' && !I.size())
            ++c, A.pb(s[i]);
        else
            if (s[i] == 'F') F.pb(s[i]);
        else
            if (s[i] == 'I') I.pb(s[i]);
        if (s[i] == 'I' && n-I.size()==1) c = 0;
        if (s[i] == 'I' && I.size() == 1) c = 0, ++c;
    }
    cout << c;
    return 0;
}


#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>
using namespace std;
ifstream fi("test.txt");
ofstream fo("out.txt");
#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define ll long long
#define For(i,n) for (int(i) = 0; (i)<(n); (i)++)
#define For1(i,n) for (int(i) = 1; (i) <= (n); (i)++)
#define Forlr(i,l,r) for (int(i) = (l); (i) <= (r); (i)++)
#define Forrl(i,r,l) for (int(i) = (r); (i) >= (l); (i)--)
#define all(a) a.begin(), a.end()
#define pb push_back
#define pp pop_back
#define mp make_pair
#define PI 3.14159265
#define putno return cout <<"NO", 0;
#define putyes return cout <<"YES", 0;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef map<int, int> mii;
//const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
//DSU
/*
int p[ N], r[N];
void init(int n) {
	For(i, n) {
		p[i] = i;
	}
}
int get(int x) {
	if (p[x] != x) {
		p[x] = get(p[x]);
	}
	return p[x];
}
bool uni(int x, int y) {
	x = get(x); y = get(y);
	if (x == y) {
		return false;
	}
	if (r[x] >= r[y]) {
		p[y] = x;
	}
	else {
		p[x] = y;
	}
	if (r[x] == r[y]) {
		r[x]++;
	}
	return true;
}
*/

// So mu
/*
int power(int x, unsigned int y, int p)
{
	int res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0)
	{
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res*x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
*/

// ReadHexa
/*
bitset<16400> b[4101];
void readHexa()
{
	For(i, n)
	{
		string st;
		cin>> st;
		For(j, m/4)
		{
			int x;
			if (st[j] >= 'A' && st[j] <= 'F')
				x = st[j] - 'A' + 10;
			else x = st[j] - '0';
			for (int k = 4; k; --k, x >>= 1)
				b[i][j * 4 + k] = x & 1;
		}
	}
}
*/

// nChoosek
/*
ll nChoosek(ll n, ll k)
{
	if (k > n) return 0;
	if (k * 2 > n) k = n - k;
	if (k == 0) return 1;

	ll result = n;
	for (ll i = 2; i <= k; ++i) {
		result *= (n - i + 1);
		result /= i;
	}
	return result;
}
*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
MIKUNO - 15/02/1999
*/
int n, m, k, cnt, rs1, q;
//ll n, m, q, k, pos, t, cnt, rs1, check;
ll maxx = -1e9, minn = 1e9;
const int maxn = N;
const ll MOD = 1e9 + 7;
int rs;
ll a[N];
int A, F, I;
int main()
{
	fast_input();
	cin >> n;
	string s;
	cin >> s;
	For(i, s.length())
		if (s[i] == 'A') A++;
		else
			if (s[i] == 'F') F++;
			else
				I++;
	if (!I)cout << A;
	else
	{
		if (I) cout << 1;
		else
			cout << 0;
	}
}


#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>
using namespace std;
ifstream fi("test.txt");
ofstream fo("out.txt");
#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define ll long long
#define For(i,n) for (int(i) = 0; (i)<(n); (i)++)
#define For1(i,n) for (int(i) = 1; (i) <= (n); (i)++)
#define Forlr(i,l,r) for (int(i) = (l); (i) <= (r); (i)++)
#define Forrl(i,r,l) for (int(i) = (r); (i) >= (l); (i)--)
#define all(a) a.begin(), a.end()
#define pb push_back
#define pp pop_back
#define mp make_pair
#define PI 3.14159265
#define putno return cout <<"NO", 0;
#define putyes return cout <<"YES", 0;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef map<int, int> mii;
//const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
//DSU
/*
int p[ N], r[N];
void init(int n) {
	For(i, n) {
		p[i] = i;
	}
}
int get(int x) {
	if (p[x] != x) {
		p[x] = get(p[x]);
	}
	return p[x];
}
bool uni(int x, int y) {
	x = get(x); y = get(y);
	if (x == y) {
		return false;
	}
	if (r[x] >= r[y]) {
		p[y] = x;
	}
	else {
		p[x] = y;
	}
	if (r[x] == r[y]) {
		r[x]++;
	}
	return true;
}
*/

// So mu
/*
int power(int x, unsigned int y, int p)
{
	int res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0)
	{
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res*x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
*/

// ReadHexa
/*
bitset<16400> b[4101];
void readHexa()
{
	For(i, n)
	{
		string st;
		cin>> st;
		For(j, m/4)
		{
			int x;
			if (st[j] >= 'A' && st[j] <= 'F')
				x = st[j] - 'A' + 10;
			else x = st[j] - '0';
			for (int k = 4; k; --k, x >>= 1)
				b[i][j * 4 + k] = x & 1;
		}
	}
}
*/

// nChoosek
/*
ll nChoosek(ll n, ll k)
{
	if (k > n) return 0;
	if (k * 2 > n) k = n - k;
	if (k == 0) return 1;

	ll result = n;
	for (ll i = 2; i <= k; ++i) {
		result *= (n - i + 1);
		result /= i;
	}
	return result;
}
*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
MIKUNO - 15/02/1999
*/
int n, m, k, cnt, rs1, q;
//ll n, m, q, k, pos, t, cnt, rs1, check;
ll maxx = -1e9, minn = 1e9;
const int maxn = N;
const ll MOD = 1e9 + 7;
int rs;
ll a[N];
int A, F, I;
int main()
{
	fast_input();
	cin >> n;
	string s;
	cin >> s;
	For(i, s.length())
		if (s[i] == 'A') A++;
		else
			if (s[i] == 'F') F++;
			else
				I++;
	if (!I)cout << A;
	else
	{
		if (I == 1) cout << 1;
		else
			cout << 0;
	}
}


#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>
using namespace std;
ifstream fi("test.txt");
ofstream fo("out.txt");
#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define ll long long
#define For(i,n) for (int(i) = 0; (i)<(n); (i)++)
#define For1(i,n) for (int(i) = 1; (i) <= (n); (i)++)
#define Forlr(i,l,r) for (int(i) = (l); (i) <= (r); (i)++)
#define Forrl(i,r,l) for (int(i) = (r); (i) >= (l); (i)--)
#define all(a) a.begin(), a.end()
#define pb push_back
#define pp pop_back
#define mp make_pair
#define PI 3.14159265
#define putno return cout <<"NO", 0;
#define putyes return cout <<"YES", 0;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef map<int, int> mii;
//const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
//DSU
/*
int p[ N], r[N];
void init(int n) {
	For(i, n) {
		p[i] = i;
	}
}
int get(int x) {
	if (p[x] != x) {
		p[x] = get(p[x]);
	}
	return p[x];
}
bool uni(int x, int y) {
	x = get(x); y = get(y);
	if (x == y) {
		return false;
	}
	if (r[x] >= r[y]) {
		p[y] = x;
	}
	else {
		p[x] = y;
	}
	if (r[x] == r[y]) {
		r[x]++;
	}
	return true;
}
*/

// So mu
/*
int power(int x, unsigned int y, int p)
{
	int res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0)
	{
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res*x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
*/

// ReadHexa
/*
bitset<16400> b[4101];
void readHexa()
{
	For(i, n)
	{
		string st;
		cin>> st;
		For(j, m/4)
		{
			int x;
			if (st[j] >= 'A' && st[j] <= 'F')
				x = st[j] - 'A' + 10;
			else x = st[j] - '0';
			for (int k = 4; k; --k, x >>= 1)
				b[i][j * 4 + k] = x & 1;
		}
	}
}
*/

// nChoosek
/*
ll nChoosek(ll n, ll k)
{
	if (k > n) return 0;
	if (k * 2 > n) k = n - k;
	if (k == 0) return 1;

	ll result = n;
	for (ll i = 2; i <= k; ++i) {
		result *= (n - i + 1);
		result /= i;
	}
	return result;
}
*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
MIKUNO - 15/02/1999
*/
int n, m, k, cnt, rs1, q;
//ll n, m, q, k, pos, t, cnt, rs1, check;
ll maxx = -1e9, minn = 1e9;
const int maxn = N;
const ll MOD = 1e9 + 7;
int rs;
ll a[N];
int A, F, I;
int main()
{
	fast_input();
	cin >> n;
	string s;
	cin >> s;
	For(i, s.length())
		if (s[i] == 'A') A++;
		else
			if (s[i] == 'F') F++;
			else
				I++;
	if (I)
		cout << I;
	else
		cout << A;
}


#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdlib>
#include<vector>
#include<set>
#include<deque>
#include<queue>
#include<math.h>
#include<chrono>
#include<list>
#include<random>
#include<bitset>
#include<assert.h>
#include<ctime>
#include<cstdio>
#include <unordered_map>
using namespace std;
ifstream fi("test.txt");
ofstream fo("out.txt");
#define fast_input() {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); }
#define ll long long
#define For(i,n) for (int(i) = 0; (i)<(n); (i)++)
#define For1(i,n) for (int(i) = 1; (i) <= (n); (i)++)
#define Forlr(i,l,r) for (int(i) = (l); (i) <= (r); (i)++)
#define Forrl(i,r,l) for (int(i) = (r); (i) >= (l); (i)--)
#define all(a) a.begin(), a.end()
#define pb push_back
#define pp pop_back
#define mp make_pair
#define PI 3.14159265
#define putno return cout <<"NO", 0;
#define putyes return cout <<"YES", 0;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef map<int, int> mii;
//const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
//DSU
/*
int p[ N], r[N];
void init(int n) {
	For(i, n) {
		p[i] = i;
	}
}
int get(int x) {
	if (p[x] != x) {
		p[x] = get(p[x]);
	}
	return p[x];
}
bool uni(int x, int y) {
	x = get(x); y = get(y);
	if (x == y) {
		return false;
	}
	if (r[x] >= r[y]) {
		p[y] = x;
	}
	else {
		p[x] = y;
	}
	if (r[x] == r[y]) {
		r[x]++;
	}
	return true;
}
*/

// So mu
/*
int power(int x, unsigned int y, int p)
{
	int res = 1; // Initialize result

	x = x % p; // Update x if it is more than or
	// equal to p

	while (y > 0)
	{
		// If y is odd, multiply x with result
		if (y & 1)
			res = (res*x) % p;

		// y must be even now
		y = y >> 1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
*/

// ReadHexa
/*
bitset<16400> b[4101];
void readHexa()
{
	For(i, n)
	{
		string st;
		cin>> st;
		For(j, m/4)
		{
			int x;
			if (st[j] >= 'A' && st[j] <= 'F')
				x = st[j] - 'A' + 10;
			else x = st[j] - '0';
			for (int k = 4; k; --k, x >>= 1)
				b[i][j * 4 + k] = x & 1;
		}
	}
}
*/

// nChoosek
/*
ll nChoosek(ll n, ll k)
{
	if (k > n) return 0;
	if (k * 2 > n) k = n - k;
	if (k == 0) return 1;

	ll result = n;
	for (ll i = 2; i <= k; ++i) {
		result *= (n - i + 1);
		result /= i;
	}
	return result;
}
*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*
MIKUNO - 15/02/1999
*/
int n, m, k, cnt, rs1, q;
//ll n, m, q, k, pos, t, cnt, rs1, check;
ll maxx = -1e9, minn = 1e9;
const int maxn = N;
const ll MOD = 1e9 + 7;
int rs;
ll a[N];
int A, F, I;
int main()
{
	fast_input();
	cin >> n;
	string s;
	cin >> s;
	For(i, s.length())
		if (s[i] == 'A') A++;
		else
			if (s[i] == 'F') F++;
			else
				I++;
	cout << max(I, A);
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {

    int n,ci=0,ca=0,cf=0;
    string s;
    cin>>n>>s;

    for(int i=0;i<n;i++){
        if(s[i]=='I')ci++;
        else if(s[i]=='A')ca++;
        else cf++;
    }

    if(ci>0)cout<<ci;else cout<<ca;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {

    int n,ci=0,ca=0,cf=0;
    string s;
    cin>>n>>s;

    for(int i=0;i<n;i++){
        if(s[i]=='I')ci++;
        else if(s[i]=='A')ca++;
        else cf++;
    }

    if(ci>0){
        if((cf>0||ca>0)&&ci==1)cout<<ci;
        else cout<<0;
    }
    else cout<<ca;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {

    int n,ci=0,ca=0,cf=0;
    string s;
    cin>>n>>s;

    for(int i=0;i<n;i++){
        if(s[i]=='I')ci++;
        else if(s[i]=='A')ca++;
        else cf++;
    }

    if(ci>0){
        if(cf>0||ca>0)cout<<ci;
        else cout<<0;
    }
    else cout<<ca;
    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#define ll long long
const int MOD = 1e9+7;
using namespace std;

signed main()
{
     int t,n,k,a=0,l=0,f=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0; i<s.length(); i++)
    {
        if(s[i]=='A') a++;
        if(s[i]=='F') f++;
        if(s[i]=='I') l++;
    }
    if(l==0){
        cout<<a<<endl;
    }
    else{
            if(l==s.length()|| l>1)
            cout<<0<<endl;
    else
        cout<<l<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#define ll long long
const int MOD = 1e9+7;
using namespace std;

signed main()
{
     int t,n,k,a=0,l=0,f=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0; i<s.length(); i++)
    {
        if(s[i]=='A') a++;
        if(s[i]=='F') f++;
        if(s[i]=='I') l++;
    }
    if(l==0){
        cout<<a<<endl;
    }
    else{
        cout<<l<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#define ll long long
const int MOD = 1e9+7;
using namespace std;

signed main()
{
     int t,n,k,a=0,l=0,f=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0; i<s.length(); i++)
    {
        if(s[i]=='A') a++;
        if(s[i]=='F') f++;
        if(s[i]=='I') l++;
    }
    if(l==0){
        cout<<a<<endl;
    }
    else{
            if(l==s.length())
            cout<<0<<endl;
    else
        cout<<l<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0; string a; cin >> n >> a;
    for ( int i=0 ; i<a.size() ; i++ )
    {
        int x=0,y=0,z=0;
        if ( a[i]=='A' || a[i]=='I')
        {
            for ( int j=0 ; j<a.size() ; j++ )
            {
                if ( a[j]=='A' && j!=i) x++;
                else if ( a[j]=='I' && j!=i) y++;
                else if ( a[j]=='F' && j!=i) z++;
            }
        }
        if ( (x>y && x>=z) || (z>y && z>=x) ) ans++;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{

    int n,x=0,y=0,z=0; string a; cin >> n >> a;
    for ( int i=0 ; i<a.size() ; i++ )
    {
        if ( a[i]=='A') x++;
        else if (a[i]=='I') y++;
        else if (a[i]=='F') z++;
    }
    if ( y==1 ) cout << 1 << endl;
    else if  ( y>1 ) cout << 0 << endl;
    else cout << x << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{

    int n,ans=0,x=0,y=0,z=0; string a; cin >> n >> a;
    for ( int i=0 ; i<a.size() ; i++ )
    {
        if ( a[i]=='A') x++;
        else if (a[i]=='I') y++;
        else if (a[i]=='F') z++;
    }
    for ( int i=0 ; i<a.size() ; i++ )
    {
        if ( a[i]=='A')
        {
            x--;
            if ( (x>=z && x>y) || (z>=x && z>y) ) ans++;
            x++;
        }
        else if ( a[i]=='I')
        {
            y--;
            if ( (x>=z && x>y) || (z>=x && z>y) ) ans++;
            y++;
        }
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{

    int n,ans=0,x=0,y=0,z=0; string a; cin >> n >> a;
    for ( int i=0 ; i<a.size() ; i++ )
    {
        if ( a[i]=='A') x++;
        else if (a[i]=='I') y++;
        else if (a[i]=='F') z++;
    }
    for ( int i=0 ; i<a.size() ; i++ )
    {
        if ( a[i]=='A')
        {
            x--;
            if ( x==n-1 || z==n-1 ) ans++;
            x++;
        }
        else if ( a[i]=='I')
        {
            y--;
            if ( x==n-1 || z==n-1 ) ans++;
            y++;
        }
        else {ans=x; break;}
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n,ans=0; string a; cin >> n >> a;
    for ( int i=0 ; i<a.size() ; i++ )
    {
        int x=0,y=0,z=0;
        if ( a[i]=='A' || a[i]=='I')
        {
            for ( int j=0 ; j<a.size() ; j++ )
            {
                if ( a[j]=='A' && j!=i) x++;
                else if ( a[j]=='I' && j!=i) y++;
                else if ( a[j]=='F' && j!=i) z++;
            }
        }
        if ( (x>y && x>=z) || (z>y && z>=x) ) ans++;
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{

    int n,x=0,y=0,z=0; string a; cin >> n >> a;
    for ( int i=0 ; i<a.size() ; i++ )
    {
        if ( a[i]=='A') x++;
        else if (a[i]=='I') y++;
        else if (a[i]=='F') z++;
    }
    if ( y==1 ) cout << 1 << endl;
    else if  ( y==0 ) cout << 0 << endl;
    else cout << x << endl;
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  char A='A',I='I',F='F';
  int n,
    cnt=0,
    p[256]={};
  cin>>n>>s;
  for(auto c:s) p[c]++;
  for(auto c:s)
    if(c==A&&p[I]==0)
      p[A]--,cnt++;
    else if(c==I&&p[I]==1)
      p[I]--,cnt++;
    else p[c]--;
  cout<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  char A='A',I='I',F='F';
  int n,cnt=0,p[256]={};
  cin>>n>>s;
  for(auto c:s)p[c]++;
  for(auto c:s)
    if(c==A&&p[I]==0)p[A]--,cnt++;
    else if(c==I&&p[I]==1)p[I]--,cnt++;
  cout<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int n;
  vector<char> c = vector<char>(256,0);
  string s;
  cin>>n>>s;
  for(auto status:s)
    c[status]++;
  if(c['I']==1) cout<<1<<endl;
  else if(c['I']==0)cout<<to_string(c['A'])<<endl;
  else cout<<0<<endl;
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int n;
  vector<char> c = vector<char>(256,0);
  string s;
  cin>>n>>s;
  for(auto status:s)
    c[status]++;
  if(c['I']==1) cout<<1<<endl;
  else if(c['I']==0)cout<<to_string(c['A'])<<endl;
  else cout<<'0'<<endl;
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  char A='A',I='I',F='F';
  int n,cnt=0,p[256]={};
  cin>>n>>s;
  for(auto c:s)p[c]++;
  if(p[I]==1){cout<<"1"<<endl; return 0;}

  for(auto c:s)
    if(c==A&&p[I]==0)p[A]--,cnt++;
    else if(c==I&&p[I]==1)p[I]--,cnt++;
  cout<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  char A='A',I='I',F='F';
  int n,cnt=0,p[256]={};
  cin>>n>>s;
  for(auto c:s)p[c]++;
  if(p[I]==1){cout<<"1"<<endl; return 0}

  for(auto c:s)
    if(c==A&&p[I]==0)p[A]--,cnt++;
    else if(c==I&&p[I]==1)p[I]--,cnt++;
  cout<<cnt<<endl;
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int n;
  vector<char> c = vector<char>(256,0);
  string s;
  cin>>n>>s;
  for(auto status:s)
    c[status]++;
  if(c['I']==1) cout<<'1'<<endl;
  else if(c['I']==0)cout<<to_string(c['A'])<<endl;
  else cout<<'0'<<endl;
  return 0;
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  string s;
  int n,
    cnt=0,
    A=0,
    I=1,
    F=2,
    p[3]={};
  cin>>n>>s;
  for(auto c:s)
    if(c=='A')p[A]++;
    else if(c=='I')p[I]++;
    else p[F]++;
  for(auto c:s)
    if(c=='A'&&p[I]==0)
      p[A]--,cnt++;
    else if(c=='I'&&p[I]==1)
      p[I]--,cnt++;
  cout<<cnt<<endl;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll i,j=0,k;
string ss;
int main()
{
    cin>>k;
    cin>>ss;
    for(i=0;i<k;i++)
    {
        if(ss[i]=='A')
            j++;
    }
    cout<<j;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,i,j;
map<char,ll>m;
int main()
{
    ll cnt=0;
    string ss;
    cin>>n;
    cin>>ss;
    for(i=0;i<ss.size();i++)
    {
        m[ss[i]]++;
    }
    if(m['I']==1)
        cout<<"1";
    else if(m['I']>1)
        cout<<"0";
    else
        cout<<m['A'];
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll i,j=0,k;
string ss;
int main()
{
    cin>>k;
    cin>>ss;
    for(i=0;i<k;i++)
    {
        if(ss[i]=='A')
        {
            j++;
        }
    }
    if(j>0)
    {
       cout<<j;
       return 0;
    }
    for(i=0;i<k;i++)
    {
        if(ss[i]=='I')
            j++;
    }
    cout<<j;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

map<char, int> a;
set<char> s;

int main()
{
    string st;
    cin >> st;
    for (int i = 0; i <= st.size() - 1; ++i)
    {
        s.insert(st[i]);
        a[st[i]]++;
    }
    if (s.size() < 3) cout << st.size() - a['F'];
    else if (s.size() == 3) cout << a['I'];
    else if (s.size() == 1)
    {
        if (a['I'] > 0) cout << 0;
        cout << st.size();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

map<char, int> a;
set<char> s;

int main()
{
    int n;
    string st;
    cin >> n >> st;
    for (int i = 0; i <= st.size() - 1; ++i)
    {
        s.insert(st[i]);
        a[st[i]]++;
    }
    if (s.size() < 3) cout << st.size() - a['F'];
    else cout << a['I'];
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

map<char, int> a;
set<char> s;

int main()
{
    int n;
    string st;
    cin >> n >> st;
    for (int i = 0; i <= st.size() - 1; ++i)
    {
        s.insert(st[i]);
        a[st[i]]++;
    }
    if (s.size() == 2) cout << st.size() - a['F'];
    else if (s.size() == 3) cout << a['I'];
    else if (s.size() == 1)
    {
        if (a['I'] > 0 || a['F'] > 0) cout << 0;
        else cout << st.size();
    }
    return 0;
}


// In The Name Of God

/*  ki oomade?!  */
#include <bits/stdc++.h>
//=============================================================
typedef long long ll;
typedef long double ld;

#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()

#define F first
#define S second

#define pii pair<int, int>
#define psi pair<string, int>
#define pis pair<int, string>

#define ashar(x) cout << fixed << showpoint << setpresicion(x);

//=============================================================

using namespace std;

const int N = 1e5 + 10, M = 1e3 + 10, MOD = 1e9 + 7;
//=============================================================

int n, cnta, cntf, cnti, ans;
string s;

int main()
{
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	cin >> n;
	cin >> s;

	for(int i = 0; i < n; i ++){
		if(s[i] == 'A')
			cnta ++;
		if(s[i] == 'F')
			cntf ++;
		if(s[i] == 'I')
			cnti ++;
	}

	for(int i = 0; i < n; i ++){
		if(s[i] == 'F')
			continue;

		if(s[i] == 'I' and cnti == 1)
			ans ++;
		if(s[i] == 'A' and !cnti)
			ans ++;
	}

	return cout << ans << endl, 0;
}


#include<bits/stdc++.h>

using namespace std;

map<char, int> a;
set<char> s;

int main()
{
    int n;
    string st;
    cin >> n >> st;
    for (int i = 0; i <= st.size() - 1; ++i)
    {
        s.insert(st[i]);
        a[st[i]]++;
    }
    if (s.size() < 3) cout << st.size() - a['F'];
    else if (s.size() == 3) cout << a['I'];
    else if (s.size() == 1)
    {
        if (a['I'] > 0) cout << 0;
        cout << st.size();
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

map<char, int> a;
set<char> s;

int main()
{
    string st;
    cin >> st;
    for (int i = 0; i <= st.size() - 1; ++i)
    {
        s.insert(st[i]);
        a[st[i]]++;
    }
    if (s.size() < 3) cout << st.size() - a['F'];
    else cout << a['I'];
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

map<char, int> a;
set<char> s;

int main()
{
    int n;
    string st;
    cin >> n >> st;
    for (int i = 0; i <= st.size() - 1; ++i)
    {
        s.insert(st[i]);
        a[st[i]]++;
    }
    if (s.size() == 2) cout << st.size() - a['F'];
    else if (s.size() == 3) cout << a['I'];
    else if (s.size() == 1)
    {
        if (a['I'] > 0) cout << 0;
        else cout << st.size();
    }
    return 0;
}


using namespace std;

map<char, int> a;
set<char> s;

int main()
{
    int n;
    string st;
    cin >> n >> st;
    for (int i = 0; i <= st.size() - 1; ++i)
    {
        s.insert(st[i]);
        a[st[i]]++;
    }
    if (s.size() == 2) cout << st.size() - a['F'];
    else if (s.size() == 3) cout << a['I'];
    else if (s.size() == 1)
    {
        if (a['I'] > 0) cout << 0;
        else cout << st.size();
    }
    return 0;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
int arr[3];
int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'F')
			arr[0]++;
		else if (s[i] == 'I')arr[1]++;
		else arr[2]++;
	}
	if (arr[1] == 1 && (arr[0] > 0 || arr[2] > 0))
		cout << arr[1] << endl;
	else if (arr[2] > 0 &&arr[1]==0)
		cout << arr[2] << endl;
	else
		cout << "0" << endl;
	#if _DEBUG
		system("pause");
#endif
	return 0;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
int arr[3];
int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'F')
			arr[0]++;
		else if (s[i] == 'I')arr[1]++;
		else arr[2]++;
	}
	if (arr[1] == 1 && (arr[0] > 0 || arr[2] > 0))
		cout << arr[1] << endl;
	else
		cout << arr[2] << endl;
	#if _DEBUG
		system("pause");
#endif
	return 0;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
int arr[3];
int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'F')
			arr[0]++;
		else if (s[i] == 'I')arr[1]++;
		else arr[2]++;
	}
	if (arr[1] == 1 && (arr[0] > 0 || arr[2] > 0))
		cout << arr[1] << endl;
	else if (arr[2] > 0)
		cout << arr[2] << endl;
	else
		cout << "0" << endl;
	#if _DEBUG
		system("pause");
#endif
	return 0;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
int arr[3];
int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'F')
			arr[0]++;
		else if (s[i] == 'I')arr[1]++;
		else arr[2]++;
	}
	if (arr[1] > 0 && (arr[0] > 0 || arr[2] > 0))
		cout << arr[1] << endl;
	else
		cout << arr[2] << endl;
	#if _DEBUG
		system("pause");
#endif
	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n , f =0 , i = 0 , a = 0 ;
    string s;
    cin>>n>>s;
    for ( int i = 0 ; i <n ; i++)
    {
        if ( s[i]=='A')
        a++;
      else  if ( s[i]=='I')
        i++;

    }
   if ( i == 1)
   cout<<i;
   else if ( i>1)
   cout<<"0";
   else
   cout<<a;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n , f =0 , i = 0 , a = 0 ;
    string s;
    cin>>n>>s;
    for ( int i = 0 ; i <n ; i++)
    {
        if ( s[i]=='A')
        a++;
      else  if ( s[i]=='I')
        i++;

    }
    cout<<max(a,i);
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n , i = 0 , a = 0 ;
    string s;
    cin>>n>>s;
    for ( int J = 0 ; J <n ; J++)
    {
        if ( s[J]=='A')
        a++;
      else  if ( s[J]=='I')
        i++;

    }

   if ( i == 1)
   cout<<i;
   else if ( i>1)
   cout<<"0";
   else
   cout<<a;
    return 0;
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long x, f = 0,C=0,D=0;
	cin >> x;
	string s;
	cin >> s;
	for (int i = 0; i < x; i++)
	{
		if (s[i] == 'I')
			C++;
		if (s[i] == 'A')
			D++;
	}
	if (C == 0)
		cout << D << "\n";
	else if (C == 1)
		cout << 1 << "\n";
	else
		cout << 0 << "\n";
}


#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int main()
{
	long long x,f=0;
	cin >> x;
	string s;
	cin >> s;
	for (int i = 0; i < x; i++)
	{
		int c = 0;
		if (s[i] != 'F')
		{
			for (int j = 0; j < x; j++)
			{
				if (j != i)
					if (s[j] == 'A' || s[j] == 'F')
						c++;
			}
			if (c == x - 1)
				f++;
		}
	}
	cout << f << "\n";
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
void play()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
int main()
{
	play();
	long long x,f=0;
	cin >> x;
	string s;
	cin >> s;
	for (int i = 0; i < x; i++)
	{
		int c = 0;
		if (s[i] != 'F')
		{
			if (s[i] == 'I')
				s[i] = '*';
			int z = s.find('I');
			if (z == -1)
				f++;
			else if (z == i)
				f++;
			if (s[i] == '*')
				s[i] = 'I';
		}
	}
	cout << f << "\n";
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	long long x,f=0;
	cin >> x;
	string s;
	cin >> s;
	for (int i = 0; i < x; i++)
	{
		int c = 0;
		if (s[i] != 'F')
		{
			if (s[i] == 'I')
				s[i] = '*';
			int z = s.find('I');
			if (z == -1)
				c++;
			else if (z == i)
				c++;
			if (c !=0)
				f++;
			if (s[i] == '*')
				s[i] = 'I';
		}
	}
	cout << f << "\n";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,count = 0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A')
        count++;
    }
    cout<<count;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,count = 0,count1=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A')
        count++;
        if(s[i]=='I')
        count1++;
    }
    if(count1>1)
    cout<<0;
    if(count1==1)
    cout<<1;
    if(count1<1)
    cout<<count;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,count = 0,count1=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A')
        count++;
        if(s[i]=='I')
        count1++;
    }
    if(count1>1)
    cout<<0;
    if(count1==1)
    cout<<1;
    else
    cout<<count;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n,c=0,k=0,l=0;
cin>>n;
string s;
cin>>s;
for (int i=0;i<n;i++){
	 if (s[i]=='F')c++;
	 if (s[i]=='A')l++;
	 if (s[i]=='I')k++;
}
if(k==0)cout<<l;else if (k==1)cout<<1;else cout<<n-c;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n,c=0,k=0,l=0;
cin>>n;
string s;
cin>>s;
for (int i=0;i<n;i++){
	 if (s[i]=='F')c++;
	 if (s[i]=='A')l++;
	 if (s[i]=='I')k++;
}
if(l>k)cout<<l;else if (l<k)cout<<k;else cout<<c;

}


#include<bits/stdc++.h>
using namespace std;
int main(){
int n,c=0,k=0,l=0;
cin>>n;
string s;
cin>>s;
for (int i=0;i<n;i++){
	 if (s[i]=='F')c++;
	 if (s[i]=='A')l++;
	 if (s[i]=='I')k++;
}
if(k>1)cout<<0;else if (k==1)cout<<1;else cout<<n-c;
}


#include<iostream>
#include<cstring>
#include<stdlib>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	string s;
	cin >> s;

	int i = count(s.begin(), s.end(), 'I');
	if(i>1)
	{
		cout << 0;
		return 0;
	}
	if(i==1)
	{
		cout << 1 << "\n";
		return 0;
	}
	int a = count(s.begin(), s.end(), 'A');
	cout << a;
}


#include<iostream>
using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	string s;
	cin >> s;

	int i = std::count(s.begin(), s.end(), 'I');
	if(i>1)
	{
		cout << 0;
		return 0;
	}
	if(i==1)
	{
		cout << 1 << "\n";
		return 0;
	}
	int a = std::count(s.begin(), s.end(), 'A');
	cout << a;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	string s;
	cin >> s;

	int i = count(s.begin(), s.end(), 'I');
	if(i>1)
	{
		cout << 0;
		return 0;
	}
	if(i==1)
	{
		cout << 1 << "\n";
		return 0;
	}
	int a = count(s.begin(), s.end(), 'A');
	cout << a;
}


#include<iostream>
#include<cstring>
#include<stdlib>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	string s;
	cin >> s;

	int i = std::count(s.begin(), s.end(), 'I');
	if(i>1)
	{
		cout << 0;
		return 0;
	}
	if(i==1)
	{
		cout << 1 << "\n";
		return 0;
	}
	int a = std::count(s.begin(), s.end(), 'A');
	cout << a;
}


#include <iostream>
#include <cstring>

//B - African Crossword

using namespace std;

int main() {
    //freopen("j.txt", "r", stdin);
    int n ,i,A=0,F=0,I=0,cnt=0;
    char data[20005];
    cin>> n>>data;

    for( i =0 ; i < n ;i++)
        data[i]=='A' ?A++: (data[i]=='F' ?F++:I++);

        if(!I)
            cnt=A;
        else if(I==1)
            cnt=1;

    cout <<cnt<<endl;
    return 0;
}


#include <iostream>
#include <cstring>

//B - African Crossword

using namespace std;

int main() {
    //freopen("j.txt", "r", stdin);
    int n ,i,A=0,F=0,I=0,cnt=0;
    char data[20005];
    cin>> n>>data;

    for( i =0 ; i < n ;i++)
        data[i]=='A' ?A++: (data[i]=='F' ?F++:I++);

    for( i =0 ; i < n ;i++)
        if(data[i]=='A' && I==0)
            cnt++;
        else  if(data[i]=='I'&& I==1)
            cnt++;

    cout <<cnt<<endl;
    return 0;
}


#include <iostream>
#include <cstring>

//Cows and Poker Game

using namespace std;

int main() {
    //freopen("j.txt", "r", stdin);
    int n ,i,A=0,F=0,I=0,cnt=0;
    char data[200005];
    cin>> n>>data;

    for( i =0 ; i < n ;i++)
        data[i]=='A' ?A++: (data[i]=='F' ?F++:I++);

        if(!I)
            cnt=A;
        else if(I==1)
            cnt=1;

    cout <<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int nA, nF, nI;

int main(){
    int n;

    cin >> n;
    getchar();

    char stat;
    for(int i = 0; i < n; i++){
        scanf("%c", &stat);

        if(stat == 'A') nA++;
        else if(stat == 'F') nF++;
        else if(stat == 'I') nI++;
    }

    if(nI > 0 && (nA > 0 || nF > 0)) {
        cout << nI << endl;
    } else if(nA > 0 && nI == 0 && nF > 0){
        cout << nA << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int nA, nF, nI;

int main(){
    int n;

    cin >> n;
    getchar();

    char stat;
    for(int i = 0; i < n; i++){
        scanf("%c", &stat);

        if(stat == 'A') nA++;
        else if(stat == 'F') nF++;
        else if(stat == 'I') nI++;
    }

    if(nI == 1 && (nA > 0 || nF > 0)) {
        cout << nI << endl;
    } else if(nA > 0 && nI == 0 && nF >= 0){
        cout << nA << endl;
    } else cout << "0\n";

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int nA, nF, nI;

int main(){
    int n;

    cin >> n;
    getchar();

    char stat;
    for(int i = 0; i < n; i++){
        scanf("%c", &stat);

        if(stat == 'A') nA++;
        else if(stat == 'F') nF++;
        else if(stat == 'I') nI++;
    }

    if(nI > 0 && (nA > 0 || nF > 0)) {
        cout << nI << endl;
    } else if(nA > 0 && nI == 0 && nF >= 0){
        cout << nA << endl;
    }
    return 0;
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	MEM(a, 0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		a[c]++;
	}
	if (a['I']) cout << a['I'] << endl;
	else cout << a['A'] << endl;
	return 0;
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	MEM(a, 0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		a[c]++;
	}
	if (a['I'] && a['I'] != n) cout << a['I'] << endl;
	else cout << a['A'] << endl;
	return 0;
}


#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	MEM(a, 0);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		char c;
		cin >> c;
		a[c]++;
	}
	if(a['I'] == 0) cout << a['A'] << endl;
	else if(a['I'] == 1) cout << a['I'] << endl;
	else cout << 0 << endl;
	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int n,c=0;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='A')
			c++;
	}
	cout<<c<<endl;

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int n,c=0,f=0;
	cin>>n;
	string s;
	cin>>s;
	c=count(s.begin(),s.end(),'A');
	f=count(s.begin(),s.end(),'F');
	if(c==0&&f>0)
	{
		c=count(s.begin(),s.end(),'I');
	}
	cout<<c<<endl;

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int n,c=0,f=0;
	cin>>n;
	string s;
	cin>>s;
	c=count(s.begin(),s.end(),'A');
	int i=count(s.begin(),s.end(),'I');
	f=count(s.begin(),s.end(),'F');
	if(c==0&&f>0)
	{
		c=count(s.begin(),s.end(),'I');
	}
	else if(f==0&&i>0)
	{
		c=0;
	}

	cout<<c<<endl;

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int n,a=0,i=0;
	cin>>n;
	string s;
	cin>>s;
	a=count(s.begin(),s.end(),'A');
	i=count(s.begin(),s.end(),'I');
	if(i==1)
		cout<<i<<endl;
	else if(i>1)
		cout<<0<<endl;
	else if(i==0)
		cout<<a<<endl;

	return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int n,c=0;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='A')
			c++;
	}
	if(c==0)
	{
		for(int i=0;i<n;i++)
			if(s[i]=='I')
				c++;
	}
	cout<<c<<endl;

	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<iomanip>
using namespace std;
int main()
{
	int n,cntA = 0, cntI = 0, cntF = 0;
	string s; cin >>n>> s;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'A')
			cntA++;
		else if (s[i] == 'I')
			cntI++;
		else
			cntF++;
	}
	if (cntI>1)
		cout << 0<<endl;
	else if (cntI == 1)
		cout << 1 << endl;
	else
		cout << cntA << endl;
//	system("pause");
}
close


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<iomanip>
using namespace std;
int main()
{
	int n,cntA = 0, cntI = 0, cntF = 0;
	string s; cin >>n>> s;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'A')
			cntA++;
		else if (s[i] == 'I')
			cntI++;
		else
			cntF++;
	}
	if (cntI>1)
		cout << 0<<endl;
	else if (cntI == 1)
		cout << 1 << endl;
	else
		cout << cntA << endl;
	system("pause");
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<iomanip>
using namespace std;
int main()
{
	int n,cntA = 0, cntI = 0, cntF = 0;
	string s; cin >>n>> s;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'A')
			cntA++;
		else if (s[i] == 'I')
			cntI++;
		else
			cntF++;
	}
	if (cntI>1)
		cout << 0<<endl;
	else if (cntI == 1)
		cout << 1 << endl;
	else
		cout << cntA << endl;
//	system("pause");
}


#include<bits/stdc++.h>
using namespace std;
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fo(i,a,b) for(ll i=a;i<b;i++)
#define pi 3.1415926536
#define ld long double
int main()
{
    int n;
    cin>>n;
    string str;
    cin>>str;
    int a=0,in=0,f=0;
    fo(i,0,n)
    {
        if(str[i]=='A')
            a++;
        if(str[i]=='I')
            in++;
        if(str[i]=='F')
            f++;
    }
    if(a+f==0)
        cout<<"0";
    else{
    if(in!=0)
        cout<<in;
    else
        cout<<a;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fo(i,a,b) for(ll i=a;i<b;i++)
#define pi 3.1415926536
#define ld long double
int main()
{
    int n;
    cin>>n;
    string str;
    cin>>str;
    int a=0,i=0,f=0;
    fo(i,0,n)
    {
        if(str[i]=='A')
            a++;
        else if(str[i]=='I')
            i++;
        else if(str[i]=='F')
            f++;
    }
    if(i!=0)
        cout<<i;
    else
        cout<<a;
    return 0;
}