#include <bits/stdc++.h>
using namespace std;
short xs[] = {1, -1}, ys[] = {2, -2}, t, i, j, ans = 64;
bool board[13][13] = {0};
int main() {
  char c;
  cin >> c >> t;
  c -= 95;
  t += 1;
  board[c][t] = 1;
  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++) {
      board[c + xs[i]][t + ys[j]] = 1;
      board[c + ys[i]][t + xs[j]] = 1;
    }
  for (i = 0; i < 12; i++) {
    board[c][i] = 1;
    board[i][t] = 1;
  }
  cin >> c >> t;
  c -= 95;
  t += 1;
  board[c][t] = 1;
  for (i = 0; i < 2; i++)
    for (j = 0; j < 2; j++) {
      board[c + xs[i]][t + ys[j]] = 1;
      board[c + ys[i]][t + xs[j]] = 1;
    }
  for (i = 0; i < 8; i++)
    for (j = 0; j < 8; j++)
      if (board[i + 2][j + 2]) ans--;
  cout << ans;
  return 0;
}
