#include <bits/stdc++.h>
int main() {
  char c;
  int x, y, i, j, map[14][14], ans = 0;
  for (i = 0; i <= 11; i++)
    for (j = 0; j <= 11; j++) map[i][j] = 0;
  scanf("%c", &c);
  scanf("%d\n", &y);
  x = c - 96;
  x++;
  y++;
  for (i = 1; i <= 10; i++) map[x][i] = 1;
  for (i = 1; i <= 10; i++) map[i][y] = 1;
  map[x][y] = 1;
  map[x - 2][y + 1] = 1;
  map[x - 2][y - 1] = 1;
  map[x - 1][y + 2] = 1;
  map[x - 1][y - 2] = 1;
  map[x + 1][y + 2] = 1;
  map[x + 1][y - 2] = 1;
  map[x + 2][y + 1] = 1;
  map[x + 2][y - 1] = 1;
  scanf("%c", &c);
  scanf("%d", &y);
  x = c - 96;
  x++;
  y++;
  map[x][y] = 1;
  map[x - 2][y + 1] = 1;
  map[x - 2][y - 1] = 1;
  map[x - 1][y + 2] = 1;
  map[x - 1][y - 2] = 1;
  map[x + 1][y + 2] = 1;
  map[x + 1][y - 2] = 1;
  map[x + 2][y + 1] = 1;
  map[x + 2][y - 1] = 1;
  for (i = 2; i <= 9; i++)
    for (j = 2; j <= 9; j++)
      if (map[i][j] == 0) ans++;
  printf("%d", ans);
}
