#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l;
  string s;
  cin >> s;
  int c, d;
  d = (int)s[1] - 48;
  c = (int)s[0] - 96;
  if ((c == 1 && d == 1) || (c == 8 && d == 1) || (c == 8 && d == 8) ||
      (c == 1 && d == 8)) {
    cout << 3;
    return 0;
  } else if ((c == 1 || c == 8 || d == 1 || d == 8)) {
    cout << 5;
    return 0;
  } else
    cout << 8;
}
