#include <bits/stdc++.h>
using namespace std;
char b[10][10];
int dr[] = {-1, -1, 1, 1, 2, -2, 2, -2};
int dc[] = {-2, 2, 2, -2, 1, 1, -1, -1};
int valid(int row, int col) {
  return (1 <= row && row <= 8 && 1 <= col && col <= 8);
}
int rook(int row, int col) {
  int ret = 0;
  for (int i = 1; i <= 8; i++) {
    if (valid(row + i, col)) {
      if (b[row + i][col] != 'x') {
        ret++;
      }
    }
    if (valid(row - i, col)) {
      if (b[row - i][col] != 'x') {
        ret++;
      }
    }
    if (valid(row, col - i)) {
      if (b[row][col - i] != 'x') {
        ret++;
      }
    }
    if (valid(row, col + i)) {
      if (b[row][col + i] != 'x') {
        ret++;
      }
    }
  }
  return ret;
}
int knight(int row, int col) {
  int ret = 0;
  for (int i = 0; i <= 7; i++) {
    if (valid(row + dr[i], col + dc[i])) {
      if (b[row + dr[i]][col + dc[i]] != 'x') {
        ret++;
      }
    }
  }
  return ret;
}
int main() {
  memset(b, 'x', sizeof(b));
  string rk, kn;
  cin >> rk;
  cin >> kn;
  int rookrow = rk[0] - 'a' + 1;
  int rookcol = rk[1] - '1' + 1;
  int krow = kn[0] - 'a' + 1;
  int kcol = kn[1] - '1' + 1;
  b[rookrow][rookcol] = 'r';
  b[krow][kcol] = 'k';
  int ans = 0;
  for (int i = 1; i <= 8; i++) {
    for (int j = 1; j <= 8; j++) {
      if (i == rookrow && j == rookcol) {
        continue;
      }
      if (i == krow && j == kcol) {
        continue;
      }
      b[i][j] = 'k';
      if (knight(i, j) == 0 && knight(krow, kcol) == 0 &&
          rook(rookrow, rookcol) == 0) {
        ans++;
      }
      b[i][j] = 'x';
    }
  }
  cout << ans;
  return 0;
}
