#include <bits/stdc++.h>
using namespace std;
bool vis[12][12];
int main() {
  char a, b;
  char c, d;
  cin >> a >> b >> c >> d;
  int q = ((int)(a)) - 97;
  int w = (b - '0') - 1;
  int e = ((int)(c)) - 97 + 2;
  int r = (d - '0') - 1 + 2;
  int t = q + 2;
  int y = w + 2;
  vis[e][r] = 1;
  vis[e + 2][r + 1] = 1;
  vis[e + 2][r - 1] = 1;
  vis[e - 2][r + 1] = 1;
  vis[e - 2][r - 1] = 1;
  vis[e + 1][r + 2] = 1;
  vis[e - 1][r + 2] = 1;
  vis[e + 1][r - 2] = 1;
  vis[e - 1][r - 2] = 1;
  vis[t + 2][y + 1] = 1;
  vis[t + 2][y - 1] = 1;
  vis[t - 2][y + 1] = 1;
  vis[t - 2][y - 1] = 1;
  vis[t + 1][y + 2] = 1;
  vis[t - 1][y + 2] = 1;
  vis[t + 1][y - 2] = 1;
  vis[t - 1][y - 2] = 1;
  for (int i = 0; i < 12; i++) {
    vis[q + 2][i] = 1;
    vis[i][w + 2] = 1;
  }
  int ans1 = 0;
  for (int i = 2; i < 10; i++) {
    for (int j = 2; j < 10; j++) {
      if (vis[i][j] == 0) {
        ans1++;
      }
    }
  }
  cout << ans1;
  return 0;
}
