#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  bool vis[12][12] = {};
  int ax = s[0] - 'a' + 2, ay = s[1] - '1' + 2, bx = t[0] - 'a' + 2,
      by = t[1] - '1' + 2;
  for (int i = 0; i < 12; i++)
    for (int j = 0; j < 12; j++)
      if (i == ax || j == ay) vis[i][j] = true;
  vector<pair<int, int>> hm = {
      make_pair(-2, -1), make_pair(-2, 1), make_pair(2, -1), make_pair(2, 1),
      make_pair(-1, -2), make_pair(-1, 2), make_pair(1, -2), make_pair(1, 2)};
  for (auto p : hm) vis[ax + p.first][ay + p.second] = true;
  if (vis[bx][by])
    cout << "0\n";
  else {
    vis[bx][by] = true;
    for (auto p : hm) vis[bx + p.first][by + p.second] = true;
    int ans = 0;
    for (int i = 2; i < 10; i++)
      for (int j = 2; j < 10; j++) ans += !vis[i][j];
    cout << ans << '\n';
  }
  return 0;
}
