#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000007;
long long ar[100][100];
int main() {
  string s;
  cin >> s;
  long long a, b, c, d;
  a = s[0] - 'a' + 1;
  b = s[1] - '0';
  for (long long i = 1; i <= 8; i++) ar[a][i] = 1;
  for (long long i = 1; i <= 8; i++) ar[i][b] = 1;
  cin >> s;
  c = s[0] - 'a' + 1;
  d = s[1] - '0';
  ar[c][d] = 1;
  long long e[] = {2, 2, -2, -2, 1, -1, 1, -1};
  long long f[] = {1, -1, 1, -1, 2, 2, -2, -2};
  for (long long i = 0; i < 8; i++) {
    if (c + e[i] >= 1 && c + e[i] <= 8 && d + f[i] >= 1 && d + f[i] <= 8)
      ar[c + e[i]][d + f[i]] = 1;
  }
  long long co = 0;
  for (long long i = 1; i <= 8; i++) {
    for (long long j = 1; j <= 8; j++) {
      if (ar[i][j] == 0) {
        long long x = 1;
        for (long long k = 0; k < 8 && x; k++) {
          if (i + e[k] == a && j + f[k] == b) x = 0;
        }
        if (x) co++;
      }
    }
  }
  cout << co;
  return 0;
}
