#include <bits/stdc++.h>
using namespace std;
int arr[8][8];
void fillup(int a, int b) {
  if (7 >= a + 2) {
    if (b <= 6) arr[a + 2][b + 1] = 0;
    if (b > 0) arr[a + 2][b - 1] = 0;
  }
  if (0 <= a - 2) {
    if (b <= 6) arr[a - 2][b + 1] = 0;
    if (b > 0) arr[a - 2][b - 1] = 0;
  }
  if (7 >= b + 2) {
    if (a <= 6) arr[a + 1][b + 2] = 0;
    if (a > 0) arr[a - 1][b + 2] = 0;
  }
  if (0 <= b - 2) {
    if (a <= 6) arr[a + 1][b - 2] = 0;
    if (a > 0) arr[a - 1][b - 2] = 0;
  }
}
int main() {
  int i, count = 0, j, a, b;
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) arr[i][j] = 1;
  }
  char c;
  cin >> c >> a;
  a = 8 - a;
  b = c - 'a';
  for (i = 0; i < 8; i++) arr[i][b] = 0;
  for (i = 0; i < 8; i++) arr[a][i] = 0;
  fillup(a, b);
  cin >> c >> a;
  a = 8 - a;
  b = c - 'a';
  arr[a][b] = 0;
  fillup(a, b);
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (arr[i][j] == 1) count++;
    }
  }
  cout << count;
  return 0;
}
