#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
bool board[8][8];
const int dx[8] = {1, 2, 2, 1, -1, -2, -2, -1};
const int dy[8] = {2, 1, -1, -2, -2, -1, 1, 2};
void check(int x, int y, int n) {
  board[x][y] = true;
  if (n == 1) {
    for (int i = (0); i < (int)(8); ++i) {
      board[i][y] = true;
      board[x][i] = true;
    }
  }
  for (int r = (0); r < (int)(8); ++r) {
    if (x + dx[r] < 8 && x + dx[r] >= 0) {
      if (y + dy[r] < 8 && y + dy[r] >= 0) {
        board[x + dx[r]][y + dy[r]] = true;
      }
    }
  }
}
int main(void) {
  int x, y, count = 0;
  string line;
  cin >> line;
  x = line[0] - 'a';
  y = line[1] - '1';
  check(x, y, 1);
  cin >> line;
  x = line[0] - 'a';
  y = line[1] - '1';
  check(x, y, 2);
  for (int x = (0); x < (int)(8); ++x) {
    for (int y = (0); y < (int)(8); ++y) {
      if (board[x][y]) count++;
    }
  }
  cout << 64 - count << endl;
  return 0;
}
