#include <bits/stdc++.h>
using namespace std;
int main() {
  int board[12][12];
  string a, b;
  unsigned int i, ii, j, aa, bb, id = 0, k = 0;
  for (i = 0; i < 12; i++)
    for (j = 0; j < 12; j++) board[i][j] = 0;
  cin >> a >> b;
  if (a[0] == 'a') aa = 0;
  if (b[0] == 'a') bb = 0;
  if (a[0] == 'b') aa = 1;
  if (b[0] == 'b') bb = 1;
  if (a[0] == 'c') aa = 2;
  if (b[0] == 'c') bb = 2;
  if (a[0] == 'd') aa = 3;
  if (b[0] == 'd') bb = 3;
  if (a[0] == 'e') aa = 4;
  if (b[0] == 'e') bb = 4;
  if (a[0] == 'f') aa = 5;
  if (b[0] == 'f') bb = 5;
  if (a[0] == 'g') aa = 6;
  if (b[0] == 'g') bb = 6;
  if (a[0] == 'h') aa = 7;
  if (b[0] == 'h') bb = 7;
  board[aa + 2][int(a[1]) - 47] = 2;
  board[bb + 2][int(b[1]) - 47] = 1;
  for (i = 2; i < 10; i++)
    for (j = 2; j < 10; j++) {
      if (board[i + 1][j - 2] != 0) id = 1;
      if (board[i + 2][j - 1] != 0) id = 1;
      if (board[i + 1][j + 2] != 0) id = 1;
      if (board[i + 2][j + 1] != 0) id = 1;
      if (board[i - 1][j + 2] != 0) id = 1;
      if (board[i - 2][j + 1] != 0) id = 1;
      if (board[i - 1][j - 2] != 0) id = 1;
      if (board[i - 2][j - 1] != 0) id = 1;
      for (ii = 2; ii < 10; ii++) {
        if (board[i][ii] == 2) id = 1;
        if (board[ii][j] == 2) id = 1;
      }
      if (board[i][j] != 0) id = 1;
      if (id == 1) k++;
      id = 0;
    }
  cout << 64 - k;
  return 0;
}
