#include <bits/stdc++.h>
int main() {
  char a[8][8];
  char x, y;
  int i, j, b = 0;
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++) a[i][j] = 1;
  scanf("%c%c", &x, &y);
  x -= 'a';
  y -= '1';
  a[x][y] = 0;
  for (i = 0; i < 8; i++) {
    a[x][i] = 0;
    a[i][y] = 0;
  }
  if (x >= 2 && y >= 1) a[x - 2][y - 1] = 0;
  if (x >= 1 && y >= 2) a[x - 1][y - 2] = 0;
  if (x >= 2 && y <= 6) a[x - 2][y + 1] = 0;
  if (x >= 1 && y <= 5) a[x - 1][y + 2] = 0;
  if (x <= 5 && y >= 1) a[x + 2][y - 1] = 0;
  if (x <= 6 && y >= 2) a[x + 1][y - 2] = 0;
  if (x <= 5 && y <= 6) a[x + 2][y + 1] = 0;
  if (x <= 6 && y <= 5) a[x + 1][y + 2] = 0;
  while (1) {
    scanf("%c", &x);
    if (x == '\n') break;
  }
  scanf("%c%c", &x, &y);
  x -= 'a';
  y -= '1';
  a[x][y] = 0;
  if (x >= 2 && y >= 1) a[x - 2][y - 1] = 0;
  if (x >= 1 && y >= 2) a[x - 1][y - 2] = 0;
  if (x >= 2 && y <= 6) a[x - 2][y + 1] = 0;
  if (x >= 1 && y <= 5) a[x - 1][y + 2] = 0;
  if (x <= 5 && y >= 1) a[x + 2][y - 1] = 0;
  if (x <= 6 && y >= 2) a[x + 1][y - 2] = 0;
  if (x <= 5 && y <= 6) a[x + 2][y + 1] = 0;
  if (x <= 6 && y <= 5) a[x + 1][y + 2] = 0;
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++) b += a[i][j];
  printf("%d", b);
  return 0;
}
