#include <bits/stdc++.h>
using namespace std;
const int N = 16 + 5;
int a[N][N], b[N][N];
void put(int x, int y, int u, int v) {
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++) {
      int dis = abs(x - i) + abs(y - j);
      if ((dis == 3 && i != x && j != y) || i == u || j == v) {
        a[i][j] = 3;
      }
    }
}
bool check(int x, int y) {
  if (a[x][y]) return false;
  int dis;
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++) {
      dis = abs(x - i) + abs(y - j);
      if (dis == 3 && i != x && j != y) {
        if (a[i][j] == 1) return false;
      }
    }
  return true;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  char ch;
  int x, y, u, v;
  cin >> ch >> y;
  x = ch - 'a' + 1;
  a[x][y] = 1;
  cin >> ch >> v;
  u = ch - 'a' + 1;
  a[u][v] = 2;
  swap(x, u);
  swap(y, v);
  put(x, y, u, v);
  a[u][v] = 1;
  int ans = 0;
  for (int i = 1; i <= 8; i++) {
    for (int j = 1; j <= 8; j++) {
      if (check(i, j)) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
