#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) {
  return {l.first + r.first, l.second + r.second};
}
typedef void (*callback_function)(void);
const long long INF64 = 1e18;
const long long INF32 = 1e9;
bool visited[10][10];
long long moves[8][2] = {{1, 2}, {1, -2}, {-1, 2}, {-1, -2},
                         {2, 1}, {2, -1}, {-2, 1}, {-2, -1}};
void tryKnight(long long x, long long y) {
  long long row, col;
  for (long long i = (0); i < (8); i++) {
    row = x + moves[i][0], col = y + moves[i][1];
    if (row < 0 || row > 7 || col < 0 || col > 7) continue;
    visited[row][col] = true;
  }
}
long long dist2(long long i, long long j, long long x, long long y) {
  i = abs(i - x), j = abs(j - y);
  return i * i + j * j;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  {
    char ch;
    long long x1, y1, x2, y2, cnt = 0;
    cin >> ch >> x1;
    x1--, y1 = ch - 'a';
    cin >> ch >> x2;
    x2--, y2 = ch - 'a';
    for (long long i = (0); i < (8); i++)
      for (long long j = (0); j < (8); j++) {
        if (i != x1 && j != y1 && (i != x2 || j != y2) &&
            dist2(i, j, x1, y1) != 5 && dist2(i, j, x2, y2) != 5)
          cnt++;
      }
    cout << cnt << endl;
  }
  return 0;
}
