#include <bits/stdc++.h>
const double oo = (1 << 30);
const double PI = acos(-1);
using namespace std;
char board[10][10];
string rook, knight;
void printBoard() {
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      printf("%c", board[i][j]);
    }
    printf("\n");
  }
  printf("\n");
}
int dr[] = {-1, -2, -2, -1, 1, 2, 2, 1};
int dc[] = {-2, -1, 1, 2, 2, 1, -1, -2};
bool canknight(int r, int c) {
  if (board[r][c] != '.') return false;
  for (int i = 0; i < 8; i++) {
    if ((r + dr[i] >= 0 && c + dc[i] >= 0 && c + dc[i] < 8 && r + dr[i] < 8)) {
      if (board[r + dr[i]][c + dc[i]] == 'o') {
        return false;
      }
    }
  }
  return true;
}
int f() {
  int ans = 0;
  int rr = rook[0] - 'a', cr = rook[1] - '1';
  int rk = knight[0] - 'a', ck = knight[1] - '1';
  for (int i = 0; i < 8; i++) {
    board[rr][i] = 'x';
    board[i][cr] = 'x';
  }
  for (int i = 0; i < 8; i++) {
    if ((rk + dr[i] >= 0 && ck + dc[i] >= 0 && ck + dc[i] < 8 &&
         rk + dr[i] < 8)) {
      board[rk + dr[i]][ck + dc[i]] = 'x';
    }
  }
  board[rk][ck] = 'o';
  board[rr][cr] = 'o';
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (canknight(i, j)) ans++;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  memset(board, '.', sizeof(board));
  cin >> rook >> knight;
  cout << f() << endl;
  return 0;
}
