#include <bits/stdc++.h>
using namespace std;
int f(char a) {
  if (a == 'a')
    return 1;
  else if (a == 'b')
    return 2;
  else if (a == 'c')
    return 3;
  else if (a == 'd')
    return 4;
  else if (a == 'e')
    return 5;
  else if (a == 'f')
    return 6;
  else if (a == 'g')
    return 7;
  else if (a == 'h')
    return 8;
  return 0;
}
int x1, x2, y3, y2, ans;
int main() {
  char yo, y0;
  cin >> yo >> x1 >> y0 >> x2;
  y3 = f(yo);
  y2 = f(y0);
  for (int x = 1; x <= 8; x++) {
    for (int y = 1; y <= 8; y++) {
      if (x == x1 && y == y3)
        continue;
      else if (x == x2 && y == y2)
        continue;
      else if (x - 2 == x1 && y - 1 == y3)
        continue;
      else if (x + 2 == x1 && y - 1 == y3)
        continue;
      else if (x - 2 == x1 && y + 1 == y3)
        continue;
      else if (x + 2 == x1 && y + 1 == y3)
        continue;
      else if (x - 2 == x2 && y - 1 == y2)
        continue;
      else if (x + 2 == x2 && y - 1 == y2)
        continue;
      else if (x - 2 == x2 && y + 1 == y2)
        continue;
      else if (x + 2 == x2 && y + 1 == y2)
        continue;
      else if (x - 1 == x1 && y - 2 == y3)
        continue;
      else if (x + 1 == x1 && y - 2 == y3)
        continue;
      else if (x - 1 == x1 && y + 2 == y3)
        continue;
      else if (x + 1 == x1 && y + 2 == y3)
        continue;
      else if (x - 1 == x2 && y - 2 == y2)
        continue;
      else if (x + 1 == x2 && y - 2 == y2)
        continue;
      else if (x - 1 == x2 && y + 2 == y2)
        continue;
      else if (x + 1 == x2 && y + 2 == y2)
        continue;
      else if (x == x1 || y == y3)
        continue;
      else
        ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}
