#include <bits/stdc++.h>
using namespace std;
void setIO(string name = "") {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if ((int)(name).size()) {
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
  }
}
void solve() {
  string s;
  cin >> s;
  int ans = 8;
  if (s[0] == 'h' || s[0] == 'a') {
    if (s[1] == '1' || s[1] == '8')
      ans = 3;
    else
      ans = 5;
  } else if (s[1] == '1' || s[1] == '8')
    ans = 5;
  cout << ans << "\n";
}
int main() {
  setIO("");
  int t = 1;
  while (t--) solve();
  return 0;
}
