#include <bits/stdc++.h>
using namespace std;
bool used[8][8];
int dx[9] = {-2, -1, 1, 2, 2, 1, -1, -2};
int dy[9] = {1, 2, 2, 1, -1, -2, -2, -1};
void la(int a, int b) {
  for (int i = 0; i < 8; ++i) used[a][i] = true;
  for (int i = 0; i < 8; ++i) used[i][b] = true;
  return;
}
int main() {
  int a, b, a2, b2;
  char a1, b1;
  cin >> a1 >> a;
  cin >> b1 >> b;
  a2 = int(a1) - 97;
  b2 = int(b1) - 97;
  --a;
  --b;
  used[b2][b] = true;
  for (int i = 0; i < 8; ++i)
    if ((b2 + dx[i] >= 0) && ((b2 + dx[i]) < 8) && (b + dy[i] >= 0) &&
        (b + dy[i]) < 8)
      used[b2 + dx[i]][b + dy[i]] = true;
  for (int i = 0; i < 8; ++i)
    if ((a2 + dx[i] >= 0) && ((a2 + dx[i]) < 8) && (a + dy[i] >= 0) &&
        (a + dy[i]) < 8)
      used[a2 + dx[i]][a + dy[i]] = true;
  la(a2, a);
  int sum = 0;
  for (int i = 0; i < 8; ++i) {
    for (int j = 0; j < 8; ++j)
      if (!used[i][j]) ++sum;
  }
  cout << sum;
  return 0;
}
