#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
long long prime[1000001];
using namespace std;
int Prime(int a) {
  for (int i = 2; i <= a / 2; ++i) {
    if (a % i == 0) {
      return 0;
    }
  }
  return 1;
}
void sieve() {
  for (int i = 2; i <= 1000000; i++) prime[i] = 1;
  int maxn = 1000000;
  for (int i = 2; i * i <= maxn; i++) {
    if (prime[i] == 1) {
      for (int j = i; j * j <= maxn; j += i) {
        prime[j] = 0;
      }
    }
  }
}
void fibo(long long a[], long long n) {
  long long x = 0;
  long long y = 1;
  a[0] = 0;
  a[1] = 1;
  for (long long i = 2; i < n; ++i) {
    a[i] = (x + y) % 10;
    x = y;
    y = a[i];
  }
}
bool binarySearch(vector<long long> arr, int l, int r, int x) {
  if (r >= l) {
    int mid = l + (r - l) / 2;
    if (arr[mid] == x) return 1;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return 0;
}
long long fact[10];
void sol() {
  fact[0] = fact[1] = 1;
  for (long long i = 2; i < 10; ++i) {
    fact[i] = i * fact[i - 1];
  }
}
bool check(long long r, long long c) {
  if (r >= 8 || r < 0 || c < 0 || c > 7) {
    return false;
  }
  return true;
}
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  long long t, n, c, d, k, b;
  string x, y, z;
  cin >> x >> y;
  long long r1 = x[0] - 'a', c1 = x[1] - '1', r2 = y[0] - 'a', c2 = y[1] - '1',
            a[8][8];
  for (long long i = 0; i < 8; ++i) {
    for (long long j = 0; j < 8; ++j) {
      a[i][j] = 0;
    }
  }
  a[r2][c2] = -1;
  for (long long i = 0; i < 8; ++i) {
    a[i][c1] = a[r1][i] = -1;
  }
  if (check(r1 + 2, c1 + 1)) {
    a[r1 + 2][c1 + 1] = -1;
  }
  if (check(r1 + 2, c1 - 1)) {
    a[r1 + 2][c1 - 1] = -1;
  }
  if (check(r1 - 2, c1 + 1)) {
    a[r1 - 2][c1 + 1] = -1;
  }
  if (check(r1 - 2, c1 - 1)) {
    a[r1 - 2][c1 - 1] = -1;
  }
  if (check(r1 + 1, c1 + 2)) {
    a[r1 + 1][c1 + 2] = -1;
  }
  if (check(r1 + 1, c1 - 2)) {
    a[r1 + 1][c1 - 2] = -1;
  }
  if (check(r1 - 1, c1 + 2)) {
    a[r1 - 1][c1 + 2] = -1;
  }
  if (check(r1 - 1, c1 - 2)) {
    a[r1 - 1][c1 - 2] = -1;
  }
  if (check(r2 + 2, c2 + 1)) {
    a[r2 + 2][c2 + 1] = -1;
  }
  if (check(r2 + 2, c2 - 1)) {
    a[r2 + 2][c2 - 1] = -1;
  }
  if (check(r2 - 2, c2 + 1)) {
    a[r2 - 2][c2 + 1] = -1;
  }
  if (check(r2 - 2, c2 - 1)) {
    a[r2 - 2][c2 - 1] = -1;
  }
  if (check(r2 + 1, c2 + 2)) {
    a[r2 + 1][c2 + 2] = -1;
  }
  if (check(r2 + 1, c2 - 2)) {
    a[r2 + 1][c2 - 2] = -1;
  }
  if (check(r2 - 1, c2 + 2)) {
    a[r2 - 1][c2 + 2] = -1;
  }
  if (check(r2 - 1, c2 - 2)) {
    a[r2 - 1][c2 - 2] = -1;
  }
  c = 0;
  for (long long i = 0; i < 8; ++i) {
    for (long long j = 0; j < 8; ++j) {
      if (a[i][j] == 0) {
        ++c;
      }
    }
  }
  cout << c;
  return 0;
}
