#include <bits/stdc++.h>
using namespace std;
void setup();
int main() {
  setup();
  int c[8][8] = {0}, a, b, k[4] = {1, -1, 2, -2}, ans = 0, t[8];
  string s1, s2;
  for (int x = 0; x < 8; x++) {
    t[x] = x;
  }
  reverse(t, t + 8);
  cin >> s1 >> s2;
  b = (s1[0] - 'a'), a = t[(s1[1] - '1')];
  for (int x = 0; x < 8; x++) {
    c[a][x] = 1;
  }
  for (int x = 0; x < 8; x++) {
    c[x][b] = 1;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (abs(k[i]) != abs(k[j]) && (a + k[i] >= 0) && (a + k[i] <= 7) &&
          (b + k[j] >= 0) && (b + k[j] <= 7)) {
        c[a + k[i]][b + k[j]] = 1;
      }
    }
  }
  b = (s2[0] - 'a'), a = t[(s2[1] - '1')], c[a][b] = 1;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (abs(k[i]) != abs(k[j]) && (a + k[i] >= 0) && (a + k[i] <= 7) &&
          (b + k[j] >= 0) && (b + k[j] <= 7)) {
        c[a + k[i]][b + k[j]] = 1;
      }
    }
  }
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (c[i][j]) {
        ans++;
      }
    }
  }
  cout << (64 - ans);
  return 0;
}
void setup() { ios_base::sync_with_stdio(false); }
