#include <bits/stdc++.h>
using namespace std;
int df[9] = {0, 1, 1, 2, 2, -1, -1, -2, -2};
int dc[9] = {0, 2, -2, 1, -1, 2, -2, 1, -1};
int r_f, r_c, k_f, k_c;
bool possible(int f, int c) {
  if (f == r_f || c == r_c) return false;
  for (int i = 0; i < 9; i++) {
    if ((f + df[i] == r_f && c + dc[i] == r_c)) return false;
    if ((f + df[i] == k_f && c + dc[i] == k_c)) return false;
  }
  return true;
}
int main() {
  char fc;
  scanf("%c%d\n", &fc, &r_c);
  r_c--;
  r_f = fc - 'a';
  scanf("%c%d\n", &fc, &k_c);
  k_c--;
  k_f = fc - 'a';
  int c = 0;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (possible(i, j)) c++;
    }
  }
  cout << c << endl;
}
