#include <bits/stdc++.h>
using namespace std;
int h[150][105], aaa, bbb, ccc, ddd, eee, fff, ggg, hhh;
int main() {
  char c, a;
  int atx, aty, kax, kay, i, j, ash,
      yon[8][2] = {{1, 2},   {1, -2}, {2, 1},   {2, -1},
                   {-1, -2}, {-1, 2}, {-2, -1}, {-2, 1}};
  int cnt = 0, say = 0, ugf = 0;
  cin >> c >> kay;
  kax = c - 'a' + 1;
  cin >> a >> aty;
  atx = a - 'a' + 1;
  for (i = 1; i <= 8; i++) {
    h[i][kay] = 1;
    h[kax][i] = 1;
  }
  h[kax][kay] = 2;
  for (i = 0; i < 8; i++)
    if (atx + yon[i][0] <= 8 && atx + yon[i][0] >= 1 && aty + yon[i][1] <= 8 &&
        aty + yon[i][1] >= 1)
      h[atx + yon[i][0]][aty + yon[i][1]] = 1;
  h[atx][aty] = 2;
  for (i = 1; i <= 8; i++)
    for (j = 1; j <= 8; j++) {
      if (h[i][j] == 0) {
        for (ash = 0; ash < 8; ash++) {
          if (h[i + yon[ash][0]][j + yon[ash][1]] != 2) ++say;
        }
      }
      if (say == 8) cnt++;
      say = 0;
    }
  cout << cnt << endl;
  return 0;
}
