#include <bits/stdc++.h>
const int s[][2] = {{-2, 1}, {-1, 2}, {1, 2},   {2, 1},
                    {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};
bool f[10][10];
char xl, yl, xs, ys;
int main() {
  scanf("%c%d\n%c%d", &xl, &yl, &xs, &ys);
  xl -= 'a';
  yl--;
  xs -= 'a';
  ys--;
  memset(f, true, sizeof(f));
  f[xl][yl] = f[xs][ys] = false;
  for (int i = 0; i < 8; i++) {
    int cx = xs + s[i][0], cy = ys + s[i][1];
    if (cx > -1 && cy > -1) f[cx][cy] = false;
    cx = xl + s[i][0];
    cy = yl + s[i][1];
    if (cx > -1 && cy > -1) f[cx][cy] = false;
  }
  for (int i = 0; i < 8; i++) {
    f[xl][i] = false;
    f[i][yl] = false;
  }
  int ans = 0;
  for (int i = 0; i < 8; i++)
    for (int j = 0; j < 8; j++) ans += f[i][j] == true;
  printf("%d", ans);
}
