#include <bits/stdc++.h>
using namespace std;
int main() {
  char lx, ly, kx, ky;
  cin >> lx >> ly >> kx >> ky;
  lx -= 96;
  ly -= 48;
  ky -= 48;
  kx -= 96;
  int n = 8, sum = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if ((i != lx || j != ly) && (i != kx || j != ky) &&
          fabs((i - lx) * (j - ly) * 1.0) != 2 &&
          fabs((i - kx) * (j - ky) * 1.0) != 2 && (lx - i) * (ly - j) != 0)
        sum++;
  cout << sum;
  return 0;
}
