#include <bits/stdc++.h>
using namespace std;
int main() {
  string c = "";
  string t = "";
  cin >> t >> c;
  char lt = t[0];
  int nt = int(t[1]) - 48;
  char lc = c[0];
  int nc = int(c[1]) - 48;
  int cnt = 16;
  vector<pair<char, int> > torre;
  vector<pair<char, int> > caballo;
  for (int i = -2; i <= 2; i += 4) {
    for (int j = -1; j <= 1; j += 2) {
      char x = lt + i;
      int y = nt + j;
      char xx = lt + j;
      int yy = nt + i;
      if (int(x) < 105 && int(x) > 96 && y < 9 && y > 0) {
        cnt++;
        torre.push_back(make_pair(x, y));
      }
      if (int(xx) < 105 && int(xx) > 96 && yy < 9 && yy > 0) {
        cnt++;
        torre.push_back(make_pair(xx, yy));
      }
    }
  }
  for (int i = -2; i <= 2; i += 4) {
    for (int j = -1; j <= 1; j += 2) {
      char x = lc + i;
      int y = nc + j;
      char xx = lc + j;
      int yy = nc + i;
      if (int(x) < 105 && int(x) > 96 && y < 9 && y > 0 && x != lt && y != nt) {
        cnt++;
        caballo.push_back(make_pair(x, y));
      }
      if (int(xx) < 105 && int(xx) > 96 && yy < 9 && yy > 0 && xx != lt &&
          yy != nt) {
        cnt++;
        caballo.push_back(make_pair(xx, yy));
      }
    }
  }
  for (int i = 0; i < torre.size(); i++) {
    for (int j = 0; j < caballo.size(); j++) {
      if (torre[i].first == caballo[j].first &&
          torre[i].second == caballo[j].second)
        cnt--;
    }
  }
  cout << 64 - cnt << "\n";
  return 0;
}
