#include <bits/stdc++.h>
using namespace std;
int arr[] = {2, 2, 1, 1, -1, -1, -2, -2};
int brr[] = {1, -1, 2, -2, -2, 2, 1, -1};
int main() {
  int n, m, i, j, k, ar[9][9] = {}, a, b, e;
  char c[3], d[3];
  scanf("%s %s", &c, &d);
  n = c[0] - 'a' + 1;
  m = c[1] - '0';
  i = d[0] - 'a' + 1;
  j = d[1] - '0';
  k = 49;
  ar[n][m] = 1;
  ar[i][j] = 1;
  for (a = 1; a <= 8; a++) ar[n][a] = 1;
  for (a = 1; a <= 8; a++) ar[a][m] = 1;
  for (a = 0; a < 8; a++) {
    b = n + arr[a];
    e = m + brr[a];
    if (b < 9 && e < 9 && b > 0 && e > 0) ar[b][e] = 1;
  }
  for (a = 0; a < 8; a++) {
    b = i + arr[a];
    e = j + brr[a];
    if (b < 9 && e < 9 && b > 0 && e > 0) ar[b][e] = 1;
  }
  k = 0;
  for (i = 1; i <= 8; i++) {
    for (j = 1; j <= 8; j++) {
      if (!ar[i][j]) k++;
    }
  }
  printf("%d", k);
}
