#include <bits/stdc++.h>
using namespace std;
int main() {
  int board[8][8] = {0};
  int row, col, count = 0;
  string rook;
  getline(cin, rook);
  switch (rook[0]) {
    case 'a':
      col = 0;
      break;
    case 'b':
      col = 1;
      break;
    case 'c':
      col = 2;
      break;
    case 'd':
      col = 3;
      break;
    case 'e':
      col = 4;
      break;
    case 'f':
      col = 5;
      break;
    case 'g':
      col = 6;
      break;
    case 'h':
      col = 7;
      break;
  }
  row = (rook[1] - '0') - 1;
  if (row + 2 <= 7 && col + 1 <= 7) board[row + 2][col + 1] = 1;
  if (row + 2 <= 7 && col - 1 <= 7 && col - 1 >= 0) board[row + 2][col - 1] = 1;
  if (row - 2 <= 7 && col - 1 <= 7 && row - 2 >= 0 && col - 1 >= 0)
    board[row - 2][col - 1] = 1;
  if (row - 2 <= 7 && col + 1 <= 7 && row - 2 >= 0) board[row - 2][col + 1] = 1;
  if (row - 1 <= 7 && col + 2 <= 7 && row - 1 >= 0) board[row - 1][col + 2] = 1;
  if (row + 1 <= 7 && col + 2 <= 7) board[row + 1][col + 2] = 1;
  if (row - 1 <= 7 && col - 2 <= 7 && row - 1 >= 0 && col - 2 >= 0)
    board[row - 1][col - 2] = 1;
  if (row + 1 <= 7 && col - 2 <= 7 && col - 2 >= 0) board[row + 1][col - 2] = 1;
  for (int i = 0; i < 8; i++) board[row][i] = 1;
  for (int i = 0; i < 8; i++) board[i][col] = 1;
  string knight;
  getline(cin, knight);
  switch (knight[0]) {
    case 'a':
      col = 0;
      break;
    case 'b':
      col = 1;
      break;
    case 'c':
      col = 2;
      break;
    case 'd':
      col = 3;
      break;
    case 'e':
      col = 4;
      break;
    case 'f':
      col = 5;
      break;
    case 'g':
      col = 6;
      break;
    case 'h':
      col = 7;
      break;
  }
  row = (knight[1] - '0') - 1;
  board[row][col] = 1;
  if (row + 2 <= 7 && col + 1 <= 7) board[row + 2][col + 1] = 1;
  if (row + 2 <= 7 && col - 1 <= 7 && col - 1 >= 0) board[row + 2][col - 1] = 1;
  if (row - 2 <= 7 && col - 1 <= 7 && row - 2 >= 0 && col - 1 >= 0)
    board[row - 2][col - 1] = 1;
  if (row - 2 <= 7 && col + 1 <= 7 && row - 2 >= 0) board[row - 2][col + 1] = 1;
  if (row - 1 <= 7 && col + 2 <= 7 && row - 1 >= 0) board[row - 1][col + 2] = 1;
  if (row + 1 <= 7 && col + 2 <= 7) board[row + 1][col + 2] = 1;
  if (row - 1 <= 7 && col - 2 <= 7 && row - 1 >= 0 && col - 2 >= 0)
    board[row - 1][col - 2] = 1;
  if (row + 1 <= 7 && col - 2 <= 7 && col - 2 >= 0) board[row + 1][col - 2] = 1;
  for (int i = 0; i < 8; i++)
    for (int y = 0; y < 8; y++)
      if (board[i][y] == 0) count++;
  cout << count;
  return 0;
}
