#include <bits/stdc++.h>
using namespace std;
int dx[8] = {1, 2, 2, 1, -1, -2, -2, -1};
int dy[8] = {2, 1, -1, -2, -2, -1, 1, 2};
bool chessboard[256][256];
int main() {
  char x1, x2, y1, y2;
  scanf("%c%c", &x1, &y1);
  scanf("\n%c%c", &x2, &y2);
  for (char i = 'a'; i <= 'h'; ++i) chessboard[y1][i] = true;
  for (char i = '1'; i <= '8'; ++i) chessboard[i][x1] = true;
  for (int i = 0; i < 8; ++i) {
    chessboard[y1 + dy[i]][x1 + dx[i]] = true;
    chessboard[y2 + dy[i]][x2 + dx[i]] = true;
  }
  chessboard[y2][x2] = true;
  int cnt = 0;
  for (int i = 'a'; i <= 'h'; ++i) {
    for (int j = '1'; j <= '8'; ++j) {
      if (chessboard[j][i] == false) ++cnt;
    }
  }
  cout << cnt;
  return 0;
}
