#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9;
const double PI = 2 * acos(0);
const double eps = 1e-9;
inline int comp(const double &a, const double &b) {
  if (fabs(a - b) < eps) return 0;
  return a > b ? 1 : -1;
}
int di[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dj[] = {0, 0, 1, -1, 1, -1, -1, 1};
int diK[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int djK[] = {-1, 1, 2, 2, 1, -1, -2, -2};
int I = 8, J = 8;
inline bool val(const int &i, const int &j) {
  if (i < 0 || j < 0 || i >= I || j >= J) return false;
  return true;
}
int ia, ja, ib, jb;
string sa, sb;
int main() {
  cin >> sa;
  ia = sa[0] - 'a';
  ja = sa[1] - '1';
  cin >> sb;
  ib = sb[0] - 'a';
  jb = sb[1] - '1';
  int ret = 0;
  for (int i = 0; i < (int)(8); i++)
    for (int j = 0; j < (int)(8); j++) {
      if (i == ia || j == ja) continue;
      if (i == ib && j == jb) continue;
      for (int k = 0; k < (int)(8); k++) {
        int ni = i + diK[k];
        int nj = j + djK[k];
        if (val(ni, nj)) {
          if (ni == ia && nj == ja) goto END;
          if (ni == ib && nj == jb) goto END;
        }
      }
      ret++;
    END:;
    }
  cout << ret << endl;
  return 0;
}
