#include <bits/stdc++.h>
using namespace std;
char cs[61];
int zx1, zy1;
int x2, y2;
int main() {
  scanf("%s", cs);
  zx1 = cs[0] - 'a', zy1 = cs[1] - '1';
  scanf("%s", cs);
  x2 = cs[0] - 'a', y2 = cs[1] - '1';
  int ret = 0;
  for (int i = (0); i < (8); i++)
    for (int j = (0); j < (8); j++) {
      if (i == x2 && j == y2) continue;
      if (i == zx1 || j == zy1) continue;
      if (abs(i - zx1) == 2 && abs(j - zy1) == 1) continue;
      if (abs(i - zx1) == 1 && abs(j - zy1) == 2) continue;
      if (abs(i - x2) == 2 && abs(j - y2) == 1) continue;
      if (abs(i - x2) == 1 && abs(j - y2) == 2) continue;
      ret++;
    }
  printf("%d\n", ret);
  return 0;
}
