#include <bits/stdc++.h>
using namespace std;
bool vis[8][8];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  char t;
  int y, x;
  cin >> t >> y;
  --y;
  x = t - 'a';
  for (int i = 0; i < 8; i++) {
    vis[i][y] = true;
    vis[x][i] = true;
  }
  auto mark = [&](int x, int y) {
    vis[x][y] = true;
    for (int i = -2; i <= 2; i++) {
      for (int j = -2; j <= 2; j++) {
        if (i * i + j * j != 5) continue;
        int dx = x + i, dy = y + j;
        if (dx >= 0 && dx < 8 && dy >= 0 && dy < 8) vis[dx][dy] = true;
      }
    }
  };
  mark(x, y);
  cin >> t >> y;
  t;
  --y;
  mark(t - 'a', y);
  int cnt = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) cnt += vis[i][j];
  }
  cout << 64 - cnt;
  return 0;
}
