#include <bits/stdc++.h>
using namespace std;
long long C(int n, int r){
  __int128 ans = 1;
  for(int i=n;i>n-r;i--){
    ans=ans*i;
  }
  for(int i=1;i<r+1;i++){
    ans = ans/i;
  }
  return ans;
}

int main(){
  int L;
  cin >> L;
  cout << C((L-1),11) << endl;
}
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define mem(a) memset(a, 0, sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef __int128_t int128;
const int maxn = 1e3 + 10;
char a[maxn];
char b[] = "atcoder";
int c[30];
int main()
{
    //cout << ("atcodeer" < "atcoder") << endl;
    IOS;
    int t;
    cin >> t;
    while (t--)
    {
        int ans = -1;
        cin >> a;
        int len = strlen(a);
        if (strcmp(a,b)>0)
            ans = 0;
        else
            for (int i = 0; i < len; i++)
            {
                if(a[i]=='a')
                    continue;
                if(a[i]<='t')
                {
                    ans = i;
                    break;
                }
                else
                {
                    ans = i - 1;
                    break;
                }
            }
                    
        cout << ans << endl;
    }
    return 0;
}