#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
inline int nxt() {
  int wow;
  scanf("%d", &wow);
  return wow;
}
inline long long int lxt() {
  long long int wow;
  scanf("%lld", &wow);
  return wow;
}
inline double dxt() {
  double wow;
  scanf("%lf", &wow);
  return wow;
}
int dx[] = {2, 1, -1, -2, -2, -1, 1, 2};
int dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
bool valid(int x, int y) {
  if (x<0 | x> 8 | y<0 | y> 8) return false;
  return true;
}
int hit[10][10];
int main() {
  string s, t;
  cin >> s >> t;
  int x = s[0] - 'a' + 1, y = s[1] - 48;
  for (int i = 1; i <= 8; i++) hit[x][i] = hit[i][y] = 1;
  for (int i = 0; i < 8; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (valid(nx, ny)) hit[nx][ny] = 1;
  }
  x = t[0] - 'a' + 1, y = t[1] - 48;
  hit[x][y] = 1;
  for (int i = 0; i < 8; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (valid(nx, ny)) hit[nx][ny] = 1;
  }
  int ans = 0;
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++)
      if (hit[i][j] == 0) ans++;
  cout << ans << endl;
  return 0;
}
