#include <bits/stdc++.h>
using namespace std;
const int e9 = 1000 * 1000 * 1000;
const long long e18 = (long long)e9 * (long long)e9;
const double pi = 3.1415926535;
void pV(int num) { cout << num << " "; }
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
double rd() {
  double x;
  scanf("%lf", &x);
  return x;
}
long long rll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
string rs() {
  string x;
  cin >> x;
  return x;
}
string rsf() {
  string s;
  char c;
  while (c = getchar()) {
    if (c < 65 || c > 90) break;
    s += c;
  }
  return s;
}
void wi(int x) { printf("%d", x); }
void wd(double x) { printf("%lf ", x); }
void wll(long long x) { printf("%lld ", x); }
void ws(string x) { cout << x << " "; }
bool mas[15][15];
int main() {
  string s = rs();
  int q = s[0] - 'a' + 4, t = s[1] - '0' + 3;
  for (int i = (int)(4); i <= (int)(11); i++) mas[q][i] = true;
  for (int i = (int)(4); i <= (int)(11); i++) mas[i][t] = true;
  mas[q + 1][t + 2] = true;
  mas[q + 1][t - 2] = true;
  mas[q - 1][t + 2] = true;
  mas[q - 1][t - 2] = true;
  mas[q + 2][t + 1] = true;
  mas[q - 2][t + 1] = true;
  mas[q + 2][t - 1] = true;
  mas[q - 2][t - 1] = true;
  string k = rs();
  q = k[0] - 'a' + 4, t = k[1] - '0' + 3;
  mas[q][t] = true;
  mas[q + 1][t + 2] = true;
  mas[q + 1][t - 2] = true;
  mas[q - 1][t + 2] = true;
  mas[q - 1][t - 2] = true;
  mas[q + 2][t + 1] = true;
  mas[q - 2][t + 1] = true;
  mas[q + 2][t - 1] = true;
  mas[q - 2][t - 1] = true;
  int ans = 0;
  for (int i = (int)(4); i <= (int)(11); i++) {
    for (int j = (int)(4); j <= (int)(11); j++) {
      if (!mas[i][j]) ans++;
    }
  }
  wi(ans);
  return 0;
}
