#include <bits/stdc++.h>
using namespace std;
int main() {
  int x1, y1, x2, y2;
  char c1, c2;
  scanf("%c%c\n", &c1, &c2);
  x1 = c1 - 'a' + 1;
  y1 = c2 - '0';
  scanf("%c%c\n", &c1, &c2);
  x2 = c1 - 'a' + 1;
  y2 = c2 - '0';
  int k = 0;
  int i, g;
  for (i = 1; i <= 8; i++) {
    for (g = 1; g <= 8; g++) {
      if ((i == x1 && g == y1) || (i == x2 && g == y2)) continue;
      if (i != x1 && g != y1 &&
          !((abs(i - x2) == 1 && abs(g - y2) == 2) ||
            (abs(i - x2) == 2 && abs(g - y2) == 1)) &&
          !((abs(i - x1) == 1 && abs(g - y1) == 2) ||
            (abs(i - x1) == 2 && abs(g - y1) == 1))) {
        k++;
      }
    }
  }
  cout << k;
  return 0;
}
