#include <bits/stdc++.h>
using namespace std;
int a[8][8] = {3, 5, 5, 5, 5, 5, 5, 3, 5, 8, 8, 8, 8, 8, 8, 5, 5, 8, 8, 8, 8, 8,
               8, 5, 5, 8, 8, 8, 8, 8, 8, 5, 5, 8, 8, 8, 8, 8, 8, 5, 5, 8, 8, 8,
               8, 8, 8, 5, 5, 8, 8, 8, 8, 8, 8, 5, 3, 5, 5, 5, 5, 5, 5, 3};
int main() {
  char c, d;
  scanf("%c%c", &c, &d);
  printf("%d", a[c - 'a'][d - '1']);
  return 0;
}
