#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[8][8];
  for (int i = 0; i < 8; ++i) {
    for (int j = 0; j < 8; ++j) {
      arr[i][j] = 1;
    }
  }
  char temp;
  int r_x;
  int r_y;
  int k_x;
  int k_y;
  scanf("%c%d", &temp, &r_y);
  r_x = (int)temp - 97;
  int res = 0;
  scanf("%c", &temp);
  scanf("%c%d", &temp, &k_y);
  k_x = (int)temp - 97;
  r_y--;
  k_y--;
  arr[r_x][r_y] = 0;
  arr[k_x][k_y] = 0;
  for (int i = 0; i < 8; ++i) {
    arr[r_x][i] = 0;
    arr[i][r_y] = 0;
  }
  for (int i = 0; i < 8; ++i) {
    for (int j = 0; j < 8; ++j) {
      if ((abs(k_x - i) == 1) && (abs(k_y - j) == 2)) arr[i][j] = 0;
      if ((abs(k_x - i) == 2) && (abs(k_y - j) == 1)) arr[i][j] = 0;
      if ((abs(r_x - i) == 1) && (abs(r_y - j) == 2)) arr[i][j] = 0;
      if ((abs(r_x - i) == 2) && (abs(r_y - j) == 1)) arr[i][j] = 0;
    }
  }
  for (int i = 0; i < 8; ++i) {
    for (int j = 0; j < 8; ++j) {
      res += arr[i][j];
    }
  }
  cout << res;
  return 0;
}
