#include <bits/stdc++.h>
const int oo = INT_MAX;
const long long int OO = 1e18;
using namespace std;
long long int GCD(long long int a, long long int b) {
  return ((!b) ? a : GCD(b, a % b));
}
long long int LCM(long long int a, long long int b) {
  return a / (GCD(a, b)) * b;
}
bool isPrime(long long int n) {
  if (n == 2) return 1;
  if (n < 2 || n % 2 == 0) return 0;
  for (long long int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return 0;
  return 1;
}
int ar[8][8];
int x[] = {2, 2, -2, -2, 1, 1, -1, -1};
int y[] = {-1, 1, -1, 1, -2, 2, -2, 2};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string r, k;
  cin >> r >> k;
  int rr = r[0] - 'a';
  int cr = r[1] - '1';
  int rk = k[0] - 'a';
  int ck = k[1] - '1';
  ar[rk][ck] = 1;
  for (int i = 0; i < 8; ++i) {
    ar[i][cr] = 1;
    ar[rr][i] = 1;
  }
  for (int i = 0; i < 8; ++i) {
    if (rr + x[i] >= 0 && rr + x[i] < 8 && cr + y[i] >= 0 && cr + y[i] < 8)
      ar[rr + x[i]][cr + y[i]] = 1;
    if (rk + x[i] >= 0 && rk + x[i] < 8 && ck + y[i] >= 0 && ck + y[i] < 8)
      ar[rk + x[i]][ck + y[i]] = 1;
  }
  int count = 0;
  for (int i = 0; i < 8; ++i)
    for (int j = 0; j < 8; ++j)
      if (!ar[i][j]) count++;
  cout << count;
  return 0;
}
