#include <bits/stdc++.h>
using namespace std;
int a[22][22];
char s[22];
int main() {
  int i, j, n, x, y;
  int count = 0;
  for (i = 1; i < 12; i++)
    for (j = 1; j < 12; j++) a[i][j] = 1;
  cin >> s;
  x = s[0] - 'a' + 1;
  y = s[1] - '0';
  for (i = 1; i < 9; i++) {
    a[x][i] = 0;
    a[i][y] = 0;
  }
  if (x > 1) {
    a[x - 2][y - 1] = 0;
    a[x - 2][y + 1] = 0;
  }
  if (y > 1) {
    a[x - 1][y - 2] = 0;
    a[x + 1][y - 2] = 0;
  }
  a[x + 2][y - 1] = 0;
  a[x + 2][y + 1] = 0;
  a[x - 1][y + 2] = 0;
  a[x + 1][y + 2] = 0;
  cin >> s;
  x = s[0] - 'a' + 1;
  y = s[1] - '0';
  if (x > 1) {
    a[x - 2][y - 1] = 0;
    a[x - 2][y + 1] = 0;
  }
  if (y > 1) {
    a[x - 1][y - 2] = 0;
    a[x + 1][y - 2] = 0;
  }
  a[x + 2][y - 1] = 0;
  a[x + 2][y + 1] = 0;
  a[x - 1][y + 2] = 0;
  a[x + 1][y + 2] = 0;
  a[x][y] = 0;
  for (i = 1; i < 9; i++)
    for (j = 1; j < 9; j++) count += a[i][j];
  cout << count << endl;
  return 0;
}
