#include <bits/stdc++.h>
using namespace std;
bool horses(int x1, int y1, int x2, int y2) {
  return ((abs(x1 - x2) == 1 && abs(y1 - y2) == 2) ||
          (abs(x1 - x2) == 2 && abs(y1 - y2) == 1));
}
bool horse_and_ladia(int x1, int y1, int x2, int y2) {
  return (horses(x1, y1, x2, y2) || (x1 == x2 || y1 == y2));
}
int main() {
  int A[8][8], i, j, xh, yh, xl, yl, answer = 0;
  string s1, s2;
  cin >> s1 >> s2;
  xh = s2[0] - 'a', yh = 7 - (s2[1] - '0' - 1), xl = s1[0] - 'a',
  yl = 7 - (s1[1] - '0' - 1);
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if ((i == yh && j == xh) || (i == yl && j == xl))
        continue;
      else {
        if (horses(j, i, xh, yh) || horse_and_ladia(j, i, xl, yl)) answer++;
      }
    }
  }
  cout << 62 - answer << endl;
  return 0;
}
