#include <bits/stdc++.h>
using namespace std;
int d[20] = {-1, -2, 1, -2, -2, 1, -2, -1, -1, 2, 1, 2, 2, 1, 2, -1};
bool m[100][100];
int main() {
  string a, b;
  cin >> a >> b;
  int x1 = a[0] - 'a' + 1;
  int y1 = a[1] - '0';
  int x = b[0] - 'a' + 1;
  int y = b[1] - '0';
  for (int i = 0; i < 16; i += 2) {
    m[x + 50 + d[i]][y + 50 + d[i + 1]] = 1;
    m[x1 + 50 + d[i]][y1 + 50 + d[i + 1]] = 1;
  }
  for (int i = 1; i <= 8; i++) {
    m[x1 + 50][i + 50] = 1;
    m[i + 50][y1 + 50] = 1;
  }
  int num = 0;
  for (int i = 51; i <= 58; i++)
    for (int j = 51; j <= 58; j++)
      if (!m[i][j]) num++;
  cout << num - 1 << endl;
}
