#include <bits/stdc++.h>
using namespace std;
const int N = 8;
int main() {
  char r1, r2;
  int x1, x2;
  while (4 == scanf(" %c%d %c%d", &r1, &x1, &r2, &x2)) {
    int y1 = r1 - 'a';
    int y2 = r2 - 'a';
    --x1;
    --x2;
    int ans = 0;
    for (int y = 0; y < (int)(N); y++)
      for (int x = 0; x < (int)(N); x++) {
        if (y1 == y || x1 == x) continue;
        int dx1 = abs(x1 - x), dy1 = abs(y1 - y);
        int dx2 = abs(x2 - x), dy2 = abs(y2 - y);
        if (dx1 > dy1) swap(dx1, dy1);
        if (dx2 > dy2) swap(dx2, dy2);
        if (dx1 == 1 && dy1 == 2) continue;
        if (dx2 == 1 && dy2 == 2) continue;
        if (dx2 == 0 && dy2 == 0) continue;
        ++ans;
      }
    printf("%d\n", ans);
  }
  return 0;
}
