#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, x, y, b, t;
  int arr[9][9] = {0};
  bool vi[9][9] = {false};
  char ch1, ch2, ch = 'a';
  char ar[9];
  for (int i = 1; i < 9; i++) {
    ar[i] = ch;
    ch++;
  }
  cin >> ch1 >> y;
  cin >> ch2 >> b;
  for (int i = 1; i < 9; i++) {
    if (ar[i] == ch1) {
      x = i;
    }
    if (ar[i] == ch2) {
      a = i;
    }
  }
  arr[x][y] = 1;
  for (int i = 1; i <= 8; i++) {
    arr[x][i] = 1;
    arr[i][y] = 1;
  }
  arr[a][b] = 1;
  if ((a + 2) <= 8 && (b + 1) <= 8) {
    arr[a + 2][b + 1] = 1;
  }
  if ((a + 2) <= 8 && (b - 1) >= 0) {
    arr[a + 2][b - 1] = 1;
  }
  if ((a - 2) >= 0 && (b + 1) <= 8) {
    arr[a - 2][b + 1] = 1;
  }
  if ((a - 2) >= 0 && (b - 1) >= 0) {
    arr[a - 2][b - 1] = 1;
  }
  if ((a + 1) <= 8 && (b + 2) <= 8) {
    arr[a + 1][b + 2] = 1;
  }
  if ((a + 1) <= 8 && (b - 2) >= 0) {
    arr[a + 1][b - 2] = 1;
  }
  if ((a - 1) >= 0 && (b + 2) <= 8) {
    arr[a - 1][b + 2] = 1;
  }
  if ((a - 1) >= 0 && (b - 2) >= 0) {
    arr[a - 1][b - 2] = 1;
  }
  if ((x + 2) <= 8 && (y + 1) <= 8) {
    arr[x + 2][y + 1] = 1;
  }
  if ((x + 2) <= 8 && (y - 1) >= 0) {
    arr[x + 2][y - 1] = 1;
  }
  if ((x - 2) >= 0 && (y + 1) <= 8) {
    arr[x - 2][y + 1] = 1;
  }
  if ((x - 2) >= 0 && (y - 1) >= 0) {
    arr[x - 2][y - 1] = 1;
  }
  if ((x + 1) <= 8 && (y + 2) <= 8) {
    arr[x + 1][y + 2] = 1;
  }
  if ((x + 1) <= 8 && (y - 2) >= 0) {
    arr[x + 1][y - 2] = 1;
  }
  if ((x - 1) >= 0 && (y + 2) <= 8) {
    arr[x - 1][y + 2] = 1;
  }
  if ((x - 1) >= 0 && (y - 2) >= 0) {
    arr[x - 1][y - 2] = 1;
  }
  long long ans = 0;
  for (int i = 1; i <= 8; i++) {
    for (int j = 1; j <= 8; j++) {
      if (arr[i][j] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
