#include <bits/stdc++.h>
using namespace std;
int main() {
  char r_x, r_y, k_x, k_y;
  scanf("%c%c\n%c%c", &r_x, &r_y, &k_x, &k_y);
  r_x -= 'a';
  k_x -= 'a';
  r_y -= '1';
  k_y -= '1';
  int places = 0;
  for (int x = 0; x < 8; x++) {
    for (int y = 0; y < 8; y++) {
      if (x != r_x && y != r_y && !(x == k_x && y == k_y) &&
          !(abs(x - k_x) == 2 && abs(y - k_y) == 1) &&
          !(abs(y - k_y) == 2 && abs(x - k_x) == 1) &&
          !(abs(x - r_x) == 2 && abs(y - r_y) == 1) &&
          !(abs(y - r_y) == 2 && abs(x - r_x) == 1))
        places++;
    }
  }
  printf("%d\n", places);
}
