#include <bits/stdc++.h>
using namespace std;
bool a[9][9];
int pos1x, pos1y, pos2x, pos2y, sum;
void mark(int x, int y) {
  if (x >= 1 && y >= 1 && x <= 8 && y <= 8) a[x][y] = 1;
}
void car() {
  int x, y;
  x = pos1x, y = pos1y;
  mark(x, y);
  while (x >= 1) x--, mark(x, y);
  x = pos1x, y = pos1y;
  while (x <= 8) x++, mark(x, y);
  x = pos1x, y = pos1y;
  while (y >= 1) y--, mark(x, y);
  x = pos1x, y = pos1y;
  while (y <= 8) y++, mark(x, y);
}
void horse() {
  int x = pos2x, y = pos2y;
  mark(x, y);
  mark(x - 1, y - 2);
  mark(x - 1, y + 2);
  mark(x - 2, y - 1);
  mark(x - 2, y + 1);
  mark(x + 1, y - 2);
  mark(x + 1, y + 2);
  mark(x + 2, y - 1);
  mark(x + 2, y + 1);
}
void kni() {
  int x = pos1x, y = pos1y;
  mark(x - 1, y - 2);
  mark(x - 1, y + 2);
  mark(x - 2, y - 1);
  mark(x - 2, y + 1);
  mark(x + 1, y - 2);
  mark(x + 1, y + 2);
  mark(x + 2, y - 1);
  mark(x + 2, y + 1);
}
void dfs() {
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++)
      if (a[i][j] == 0) sum++;
}
void input() {
  char c = getchar();
  pos1x = c - 'a' + 1;
  c = getchar();
  pos1y = c - '0';
  getchar();
  c = getchar();
  pos2x = c - 'a' + 1;
  c = getchar();
  pos2y = c - '0';
  car();
  horse();
  kni();
  dfs();
  printf("%d", sum);
}
int main() {
  input();
  return 0;
}
