#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 7;
template <typename T>
void out(const T& t) {
  std::cout << t << "\n";
}
void solve() {
  int a[8][8] = {0}, r, c, ans = 0;
  string s;
  cin >> s;
  r = ((int)s[0]) % 97;
  c = ((int)s[1]) % 49;
  for (int i = 0; i < 8; i++) a[r][i] = 1;
  for (int i = 0; i < 8; i++) a[i][c] = 1;
  if (c + 2 < 8) {
    if (r - 1 >= 0) a[r - 1][c + 2] = 1;
    if (r + 1 < 8) a[r + 1][c + 2] = 1;
  }
  if (c - 2 >= 0) {
    if (r - 1 >= 0) a[r - 1][c - 2] = 1;
    if (r + 1 < 8) a[r + 1][c - 2] = 1;
  }
  if (r + 2 < 8) {
    if (c + 1 < 8) a[r + 2][c + 1] = 1;
    if (c - 1 >= 0) a[r + 2][c - 1] = 1;
  }
  if (r - 2 >= 0) {
    if (c + 1 < 8) a[r - 2][c + 1] = 1;
    if (c - 1 >= 0) a[r - 2][c - 1] = 1;
  }
  cin >> s;
  r = ((int)s[0]) % 97;
  c = ((int)s[1]) % 49;
  if (c + 2 < 8) {
    if (r - 1 >= 0) a[r - 1][c + 2] = 1;
    if (r + 1 < 8) a[r + 1][c + 2] = 1;
  }
  if (c - 2 >= 0) {
    if (r - 1 >= 0) a[r - 1][c - 2] = 1;
    if (r + 1 < 8) a[r + 1][c - 2] = 1;
  }
  if (r + 2 < 8) {
    if (c + 1 < 8) a[r + 2][c + 1] = 1;
    if (c - 1 >= 0) a[r + 2][c - 1] = 1;
  }
  if (r - 2 >= 0) {
    if (c + 1 < 8) a[r - 2][c + 1] = 1;
    if (c - 1 >= 0) a[r - 2][c - 1] = 1;
  }
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (a[i][j] == 0) ans++;
    }
  }
  out(ans - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
