#include <bits/stdc++.h>
using namespace std;
long long abc(long long a) { return a < 0 ? -a : a; }
int main() {
  ios::sync_with_stdio(0);
  string sa, sd;
  cin >> sa >> sd;
  long long xa = sa[1] - '0' + 1, ya = sa[0] - 'a' + 2, xb = sd[1] - '0' + 1,
            yb = sd[0] - 'a' + 2;
  vector<vector<long long> > a;
  for (long long(i) = (0); (i) < (long long)12; (i)++)
    a.push_back(vector<long long>(12));
  for (long long(i) = (0); (i) < (long long)12; (i)++) a[i][ya] = 1;
  for (long long(i) = (0); (i) < (long long)12; (i)++) a[xa][i] = 1;
  a[xb][yb] = 1;
  for (long long(i) = (0); (i) < (long long)12; (i)++)
    for (long long(j) = (0); (j) < (long long)12; (j)++) {
      if (abc(i - xa) == 1 && abc(j - ya) == 2) a[i][j] = 1;
      if (abc(i - xa) == 2 && abc(j - ya) == 1) a[i][j] = 1;
      if (abc(i - xb) == 1 && abc(j - yb) == 2) a[i][j] = 1;
      if (abc(i - xb) == 2 && abc(j - yb) == 1) a[i][j] = 1;
    }
  long long c = 0;
  for (long long(i) = (2); (i) < (long long)10; (i)++)
    for (long long(j) = (2); (j) < (long long)10; (j)++)
      if (!a[i][j]) c++;
  cout << c;
  return 0;
}
