#include <bits/stdc++.h>
using namespace std;
int a[9][9];
int main() {
  string s;
  int i, j, z = 0;
  cin >> s;
  a[s[0] - 'a' + 1][s[1] - '1' + 1] = 1;
  for (i = 1; i <= 8; i++) {
    if (i != s[0] - 'a' + 1) {
      a[i][s[1] - '1' + 1] = 3;
    }
    if (i != s[1] - '1' + 1) {
      a[s[0] - 'a' + 1][i] = 3;
    }
  }
  if (s[0] - 'a' + 1 > 2 && s[1] - '1' + 1 > 1)
    a[s[0] - 'a' + 1 - 2][s[1] - '1' + 1 - 1] = 4;
  if (s[0] - 'a' + 1 > 2 && s[1] - '1' + 1 < 8)
    a[s[0] - 'a' + 1 - 2][s[1] - '1' + 1 + 1] = 4;
  if (s[0] - 'a' + 1 < 7 && s[1] - '1' + 1 > 1)
    a[s[0] - 'a' + 1 + 2][s[1] - '1' + 1 - 1] = 4;
  if (s[0] - 'a' + 1 < 7 && s[1] - '1' + 1 < 8)
    a[s[0] - 'a' + 1 + 2][s[1] - '1' + 1 + 1] = 4;
  if (s[0] - 'a' + 1 > 1 && s[1] - '1' + 1 > 2)
    a[s[0] - 'a' + 1 - 1][s[1] - '1' + 1 - 2] = 4;
  if (s[0] - 'a' + 1 > 1 && s[1] - '1' + 1 < 7)
    a[s[0] - 'a' + 1 - 1][s[1] - '1' + 1 + 2] = 4;
  if (s[0] - 'a' + 1 < 8 && s[1] - '1' + 1 > 2)
    a[s[0] - 'a' + 1 + 1][s[1] - '1' + 1 - 2] = 4;
  if (s[0] - 'a' + 1 < 8 && s[1] - '1' + 1 < 7)
    a[s[0] - 'a' + 1 + 1][s[1] - '1' + 1 + 2] = 4;
  cin >> s;
  a[s[0] - 'a' + 1][s[1] - '1' + 1] = 2;
  if (s[0] - 'a' + 1 > 2 && s[1] - '1' + 1 > 1)
    a[s[0] - 'a' + 1 - 2][s[1] - '1' + 1 - 1] = 4;
  if (s[0] - 'a' + 1 > 2 && s[1] - '1' + 1 < 8)
    a[s[0] - 'a' + 1 - 2][s[1] - '1' + 1 + 1] = 4;
  if (s[0] - 'a' + 1 < 7 && s[1] - '1' + 1 > 1)
    a[s[0] - 'a' + 1 + 2][s[1] - '1' + 1 - 1] = 4;
  if (s[0] - 'a' + 1 < 7 && s[1] - '1' + 1 < 8)
    a[s[0] - 'a' + 1 + 2][s[1] - '1' + 1 + 1] = 4;
  if (s[0] - 'a' + 1 > 1 && s[1] - '1' + 1 > 2)
    a[s[0] - 'a' + 1 - 1][s[1] - '1' + 1 - 2] = 4;
  if (s[0] - 'a' + 1 > 1 && s[1] - '1' + 1 < 7)
    a[s[0] - 'a' + 1 - 1][s[1] - '1' + 1 + 2] = 4;
  if (s[0] - 'a' + 1 < 8 && s[1] - '1' + 1 > 2)
    a[s[0] - 'a' + 1 + 1][s[1] - '1' + 1 - 2] = 4;
  if (s[0] - 'a' + 1 < 8 && s[1] - '1' + 1 < 7)
    a[s[0] - 'a' + 1 + 1][s[1] - '1' + 1 + 2] = 4;
  for (i = 1; i <= 8; i++) {
    for (j = 1; j <= 8; j++) {
      if (a[i][j] == 0) {
        z++;
      }
    }
  }
  cout << z;
}
