#include <bits/stdc++.h>
int a[11][11] = {0};
int main() {
  char st1[3], st2[3];
  int n, m, i, j, s, p;
  scanf("%s", st1);
  scanf("%s", st2);
  s = 0;
  for (i = 1; i < 11; i++)
    for (j = 1; j < 11; j++) a[i][j] = 1;
  for (i = 1; i < 11; i++) {
    a[i][st1[1] - 47] = 3;
    a[st1[0] - 95][i] = 3;
  }
  a[st2[0] - 97][st2[1] - 48] = 3;
  a[st2[0] - 96][st2[1] - 49] = 3;
  a[st2[0] - 97][st2[1] - 46] = 3;
  a[st2[0] - 96][st2[1] - 45] = 3;
  a[st2[0] - 93][st2[1] - 46] = 3;
  a[st2[0] - 93][st2[1] - 48] = 3;
  a[st2[0] - 94][st2[1] - 45] = 3;
  a[st2[0] - 94][st2[1] - 49] = 3;
  a[st1[0] - 97][st1[1] - 48] = 3;
  a[st1[0] - 96][st1[1] - 49] = 3;
  a[st1[0] - 97][st1[1] - 46] = 3;
  a[st1[0] - 96][st1[1] - 45] = 3;
  a[st1[0] - 93][st1[1] - 46] = 3;
  a[st1[0] - 93][st1[1] - 48] = 3;
  a[st1[0] - 94][st1[1] - 45] = 3;
  a[st1[0] - 94][st1[1] - 49] = 3;
  for (i = 2; i <= 9; i++)
    for (j = 2; j <= 9; j++)
      if (a[i][j] == 1) s++;
  printf("%d", s - 1);
  return 0;
}
