#include <bits/stdc++.h>
using namespace std;
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a < b ? a : b; }
inline int gcd(int a, int b) {
  if (a % b)
    return gcd(b, a % b);
  else
    return b;
}
inline int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
inline int And(int mask, int bit) { return mask & (1 << bit); }
inline int Or(int mask, int bit) { return mask | (1 << bit); }
inline int Xor(int mask, int bit) { return mask ^ (1 << bit); }
char s1[3], s2[3];
int mark[9][9];
int dx[] = {0, -2, -1, 1, 2, 2, 1, -1, -2};
int dy[] = {0, 1, 2, 2, 1, -1, -2, -2, -1};
int isOk(int u, int v) { return (u >= 1 && u <= 8 && v >= 1 && v <= 8); }
int main() {
  int res = 0, u, v, u1, v1, nx, ny;
  scanf(" %s ", s1);
  scanf(" %s ", s2);
  u = s2[0] - 'a' + 1;
  v = s2[1] - '0';
  u1 = s1[0] - 'a' + 1;
  v1 = s1[1] - '0';
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++) mark[i][j] = 0;
  for (int i = 1; i <= 8; i++) mark[u1][i] = 1;
  for (int i = 1; i <= 8; i++) mark[i][v1] = 1;
  for (int i = 0; i < 9; i++) {
    nx = u + dx[i];
    ny = v + dy[i];
    if (isOk(nx, ny)) mark[nx][ny] = 1;
    nx = u1 + dx[i];
    ny = v1 + dy[i];
    if (isOk(nx, ny)) mark[nx][ny] = 1;
  }
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++)
      if (!mark[i][j]) res++;
  printf("%d\n", res);
}
