#include <bits/stdc++.h>
using namespace std;
int main() {
  string torre, cavalo;
  cin >> torre >> cavalo;
  int i, j, a, b;
  bool tab[9][9];
  for (int x = 1; x <= 8; x++)
    for (int y = 1; y <= 8; y++) tab[x][y] = false;
  i = torre[0] - 96;
  j = torre[1] - 48;
  for (int x = 1; x <= 8; x++) {
    tab[i][x] = true;
    tab[x][j] = true;
  }
  a = torre[0] - 96;
  b = torre[1] - 48;
  i = cavalo[0] - 96;
  j = cavalo[1] - 48;
  int ans = 48;
  int posi[8] = {-1, -2, -2, -1, +1, +2, +2, +1};
  int posj[8] = {-2, -1, +1, +2, +2, +1, -1, -2};
  for (int k = 0; k < 8; k++) {
    int auxa = a + posi[k];
    int auxb = b + posj[k];
    int auxi = i + posi[k];
    int auxj = j + posj[k];
    if ((auxa > 0 && auxa < 9) && (auxb > 0 && auxb < 9)) {
      if (tab[auxa][auxb] == false) {
        tab[auxa][auxb] = true;
        ans--;
      }
    }
    if ((auxi > 0 && auxi < 9) && (auxj > 0 && auxj < 9)) {
      if (tab[auxi][auxj] == false) {
        tab[auxi][auxj] = true;
        ans--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
