#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, i, j;
  char e, f;
  string s, x, y;
  set<string> v;
  cin >> x >> y;
  x[0] = x[0] - 'a' + 1 + '0';
  a = x[0] - 'a' + 1;
  b = x[1] - '0' + 1;
  e = x[0];
  f = x[1];
  y[0] = y[0] - 'a' + 1 + '0';
  v.insert(x);
  v.insert(y);
  for (i = 1; i <= 8; i++) {
    s = "";
    s += x[0];
    s += (i + '0');
    v.insert(s);
    s = "";
    s += (i + '0');
    s += x[1];
    v.insert(s);
  }
  s = "";
  s = x[0] + 1;
  s += x[1] + 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = x[0] - 1;
  s += x[1] + 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = x[0] + 2;
  s += x[1] + 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = x[0] - 2;
  s += x[1] + 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = x[0] + 1;
  s += x[1] - 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = x[0] + 2;
  s += x[1] - 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = x[0] - 1;
  s += x[1] - 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = x[0] - 2;
  s += x[1] - 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] + 1;
  s += y[1] + 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] - 1;
  s += y[1] + 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] + 2;
  s += y[1] + 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] - 2;
  s += y[1] + 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] + 1;
  s += y[1] - 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] + 2;
  s += y[1] - 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] - 1;
  s += y[1] - 2;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  s = "";
  s = y[0] - 2;
  s += y[1] - 1;
  if (s[1] >= '1' && s[1] <= '8' && s[0] >= '1' && s[0] <= '8') {
    v.insert(s);
  }
  cout << 64 - v.size() << endl;
  return 0;
}
