#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int temp = s[0] - 'a' + 1;
  if (temp == 1 || temp == 8 || s[1] - '0' == 1 || s[1] - '0' == 8) {
    cerr << "temp"
         << " is " << temp << '\n';
    ;
    temp += s[1] - '0';
    if (temp == 2 || temp == 9 || temp == 16)
      cout << 3;
    else
      cout << 5;
  } else
    cout << 8;
  return 0;
}
