#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000 * 1000 * 10 + 7;
const long long INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const long long MOD2 = 998244353;
const long long N = 1000 * 1000 + 10;
const long long N2 = 70;
const long double PI = 3.141592653589793;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long power(long long x, long long y, long long p = LLONG_MAX) {
  long long res = 1;
  x %= p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
void solve() {}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a[100][100];
  for (long long i = 0; i < 100; i++) {
    for (long long j = 0; j < 100; j++) {
      a[i][j] = 1;
    }
  }
  string s[2];
  cin >> s[0] >> s[1];
  long long f = 0;
  {
    long long j = (long long)(s[f][0] - 'a') + 2;
    long long k = (long long)(s[f][1] - '1') + 2;
    a[j][k] = 0;
    for (long long i = 2; i <= 9; i++) {
      a[i][k] = 0;
    }
    for (long long i = 2; i <= 9; i++) {
      a[j][i] = 0;
    }
    a[j + 2][k + 1] = 0;
    a[j + 2][k - 1] = 0;
    a[j - 2][k + 1] = 0;
    a[j - 2][k - 1] = 0;
    a[j - 1][k + 2] = 0;
    a[j - 1][k - 2] = 0;
    a[j + 1][k + 2] = 0;
    a[j + 1][k - 2] = 0;
  }
  f = 1;
  {
    long long j = (long long)(s[f][0] - 'a') + 2;
    long long k = (long long)(s[f][1] - '1') + 2;
    a[j][k] = 0;
    a[j + 2][k + 1] = 0;
    a[j + 2][k - 1] = 0;
    a[j - 2][k + 1] = 0;
    a[j - 2][k - 1] = 0;
    a[j - 1][k + 2] = 0;
    a[j - 1][k - 2] = 0;
    a[j + 1][k + 2] = 0;
    a[j + 1][k - 2] = 0;
  }
  long long cnt = 0;
  for (long long i = 2; i <= 9; i++) {
    for (long long j = 2; j <= 9; j++) {
      if (a[i][j] == 1) {
        cnt++;
      }
    }
  }
  cout << cnt;
  return 0;
}
