#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 64;
  string rockPosition, knightPosition;
  cin >> rockPosition >> knightPosition;
  char rockCol = rockPosition[0];
  char rockRow = rockPosition[1];
  char knightCol = knightPosition[0];
  char knightRow = knightPosition[1];
  set<string> busyDots;
  busyDots.insert(knightPosition);
  for (int i = 1; i <= 8; i++)
    busyDots.insert(string(1, rockCol) + to_string(i));
  for (char c = 'a'; c <= 'h'; c++)
    busyDots.insert(string(1, (char)(c)) + string(1, (char)(rockRow)));
  if (knightRow <= '6' && knightCol <= 'g')
    busyDots.insert(string(1, (char)(knightCol + 1)) +
                    string(1, (char)(knightRow + 2)));
  if (knightRow <= '7' && knightCol <= 'f')
    busyDots.insert(string(1, (char)(knightCol + 2)) +
                    string(1, (char)(knightRow + 1)));
  if (knightRow <= '6' && knightCol >= 'b')
    busyDots.insert(string(1, (char)(knightCol - 1)) +
                    string(1, (char)(knightRow + 2)));
  if (knightRow <= '7' && knightCol >= 'c')
    busyDots.insert(string(1, (char)(knightCol - 2)) +
                    string(1, (char)(knightRow + 1)));
  if (knightRow >= '3' && knightCol <= 'g')
    busyDots.insert(string(1, (char)(knightCol + 1)) +
                    string(1, (char)(knightRow - 2)));
  if (knightRow >= '2' && knightCol <= 'f')
    busyDots.insert(string(1, (char)(knightCol + 2)) +
                    string(1, (char)(knightRow - 1)));
  if (knightRow >= '3' && knightCol >= 'b')
    busyDots.insert(string(1, (char)(knightCol - 1)) +
                    string(1, (char)(knightRow - 2)));
  if (knightRow >= '2' && knightCol >= 'c')
    busyDots.insert(string(1, (char)(knightCol - 2)) +
                    string(1, (char)(knightRow - 1)));
  if (rockRow <= '6' && rockCol <= 'g')
    busyDots.insert(string(1, (char)(rockCol + 1)) +
                    string(1, (char)(rockRow + 2)));
  if (rockRow <= '7' && rockCol <= 'f')
    busyDots.insert(string(1, (char)(rockCol + 2)) +
                    string(1, (char)(rockRow + 1)));
  if (rockRow <= '6' && rockCol >= 'b')
    busyDots.insert(string(1, (char)(rockCol - 1)) +
                    string(1, (char)(rockRow + 2)));
  if (rockRow <= '7' && rockCol >= 'c')
    busyDots.insert(string(1, (char)(rockCol - 2)) +
                    string(1, (char)(rockRow + 1)));
  if (rockRow >= '3' && rockCol <= 'g')
    busyDots.insert(string(1, (char)(rockCol + 1)) +
                    string(1, (char)(rockRow - 2)));
  if (rockRow >= '2' && rockCol <= 'f')
    busyDots.insert(string(1, (char)(rockCol + 2)) +
                    string(1, (char)(rockRow - 1)));
  if (rockRow >= '3' && rockCol >= 'b')
    busyDots.insert(string(1, (char)(rockCol - 1)) +
                    string(1, (char)(rockRow - 2)));
  if (rockRow >= '2' && rockCol >= 'c')
    busyDots.insert(string(1, (char)(rockCol - 2)) +
                    string(1, (char)(rockRow - 1)));
  cout << 64 - busyDots.size();
  return 0;
}
