#include <bits/stdc++.h>
using namespace std;
char buf[8];
int r1, r2, k1, k2;
bool horse(int p, int q, int a, int b) {
  int s = p - a;
  if (s < 0) s = -s;
  int t = q - b;
  if (t < 0) t = -t;
  return (s == 2 && t == 1) || (s == 1 && t == 2);
}
int main() {
  scanf("%s", buf);
  r1 = buf[0] - 'a';
  r2 = buf[1] - '1';
  scanf("%s", buf);
  k1 = buf[0] - 'a';
  k2 = buf[1] - '1';
  int res = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      int tmp = 1;
      if (i == r1 || j == r2) tmp = 0;
      if (i == k1 && j == k2) tmp = 0;
      if (horse(i, j, k1, k2) || horse(i, j, r1, r2)) tmp = 0;
      res += tmp;
    }
  }
  printf("%d\n", res);
}
