#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<pair<long long, long long>, long long> &a,
               const pair<pair<long long, long long>, long long> &b) {
  return (a.second < b.second);
}
string add(string st1, string st2) {
  long long r = 0;
  string ans;
  ans.resize(3000);
  for (long long i = 2999; i >= 0; i--) {
    long long x = st1[i] - '0';
    long long y = st2[i] - '0';
    long long z = x + y + r;
    if (z >= 10) {
      r = 1;
    } else
      r = 0;
    ans[i] = (z % 10) + '0';
  }
  return ans;
}
long long p(long long x) { return ((x % 1000000007) * 2) % 1000000007; }
long long f(long long h, set<long long> s, long long ans) {
  if (h <= 1) {
    return ans;
  }
  cout << ans << endl;
  long long ans1, ans2, ans3, ans4;
  if (s.find(h - 1) == s.end()) {
    ans1 = f(h - 1, s, ans);
  } else {
    ans1 = f(h - 1, s, ans + 1);
  }
  if (s.find(h - 1) == s.end()) {
    ans2 = f(h - 2, s, ans + 1);
  } else {
    ans2 = f(h - 2, s, ans);
  }
  cout << ans1 << " " << ans2 << "t\n";
  return min(ans1, ans2);
}
long long gcdExtended(long long a, long long b, long long *x, long long *y);
long long modInverse(long long a, long long m) {
  long long x, y;
  long long g = gcdExtended(a, m, &x, &y);
  long long res = (x % m + m) % m;
  return res;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long nCr(long long n, long long r) {
  long long u = 1;
  long long m = 998244353;
  for (long long i = 0; i < r; i++) {
    u = (u * (n - i)) % m;
  }
  long long d = 1;
  for (long long i = 1; i <= r; i++) {
    d = (d * i) % m;
  }
  return (u * modInverse(d, m)) % m;
}
long long Pow(long long a, long long b) {
  if (b == 0) return 1;
  if (a == 0) return 1;
  long long an = 1;
  while (b--) {
    an *= a;
  }
  return an;
}
long long sumofdig(long long x) {
  long long s = 0;
  while (x) {
    s += x % 10;
    x /= 10;
  }
  return s;
}
long long num(string st) {
  long long n = st.size();
  long long s = 0;
  for (long long i = 0; i < n; i++) {
    s = s * 10 + st[i] - '0';
  }
  return s;
}
string str(long long n) {
  string st;
  while (n) {
    st.push_back(n % 10 + '0');
    n /= 10;
  }
  reverse(st.begin(), st.end());
  ;
  return st;
}
long long ar[1000000 + 10];
int main() {
  long long q = 1;
  long long m = 1000000007;
  while (q--) {
    string st1, st2;
    cin >> st1 >> st2;
    long long x1 = st1[0] - 'a';
    long long y1 = st1[1] - '1';
    long long x2 = st2[0] - 'a';
    long long y2 = st2[1] - '1';
    long long mat[9][9];
    for (long long i = 0; i < 8; i++) {
      for (long long j = 0; j < 8; j++) {
        mat[i][j] = 0;
      }
    }
    for (long long i = 0; i < 8; i++) {
      mat[x1][i] = 1;
      mat[i][y1] = 1;
    }
    long long ans = 0;
    for (long long x = 0; x < 8; x++) {
      for (long long y = 0; y < 8; y++) {
        if ((abs(x - x1) == 2 && abs(y - y1) == 1) ||
            (abs(x - x1) == 1 && abs(y - y1) == 2)) {
        } else if ((abs(x - x2) == 2 && abs(y - y2) == 1) ||
                   (abs(x - x2) == 1 && abs(y - y2) == 2)) {
        } else if (x == x1 || y == y1) {
        } else {
          ans++;
        }
      }
    }
    cout << ans - 1 << endl;
  }
}
