#include <bits/stdc++.h>
using namespace std;
int main() {
  int p = 0;
  char a, c;
  int b, d;
  cin >> a >> b >> c >> d;
  a = a - 'a', c = c - 'a';
  b = b - 1, d = d - 1;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if ((i == a || j == b) || (i == c && j == d) ||
          (abs((i - a) * (j - b)) == 2 || abs((i - c) * (j - d)) == 2))
        ;
      else
        p++;
    }
  }
  cout << p << endl;
}
