#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string a, b;
  cin >> a >> b;
  long long int A[9][9] = {};
  A[a[0] - 'a' + 1][a[1] - '1' + 1] = 1;
  A[b[0] - 'a' + 1][b[1] - '1' + 1] = 1;
  for (long long int i = 0; i < 9; i++)
    A[a[0] - 'a' + 1][i] = 1, A[i][a[1] - '1' + 1] = 1;
  long long int c = b[0] - 'a' + 1;
  long long int d = b[1] - '1' + 1;
  vector<pair<long long int, long long int> > v;
  v = {{c + 2, d + 1}, {c + 2, d - 1}, {c + 1, d + 2}, {c + 1, d - 2},
       {c - 1, d + 2}, {c - 1, d - 2}, {c - 2, d + 1}, {c - 2, d - 1}};
  for (auto i : v)
    if (i.first >= 1 && i.first <= 8 && i.second >= 1 && i.second <= 8)
      A[i.first][i.second] = 1;
  c = a[0] - 'a' + 1;
  d = a[1] - '1' + 1;
  v = {{c + 2, d + 1}, {c + 2, d - 1}, {c + 1, d + 2}, {c + 1, d - 2},
       {c - 1, d + 2}, {c - 1, d - 2}, {c - 2, d + 1}, {c - 2, d - 1}};
  for (auto i : v)
    if (i.first >= 1 && i.first <= 8 && i.second >= 1 && i.second <= 8)
      A[i.first][i.second] = 1;
  long long int ans = 0;
  for (long long int i = 1; i <= 8; i++)
    for (long long int j = 1; j <= 8; j++)
      if (A[i][j] == 0) ans++;
  cout << ans;
}
