#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int ans = 0;
  char a, b;
  int x, y, u, v;
  cin >> a >> y;
  cin >> b >> v;
  x = a - 'a';
  u = b - 'a';
  y--;
  v--;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (!(i == x || j == y || (i == u && j == v) ||
            (abs(i - u) * abs(j - v) == 2) || (abs(i - x) * abs(j - y) == 2)))
        ans++;
    }
  }
  cout << ans;
  return 0;
}
