//============================================================================
// Name        : [email protected]	B. Chess
// Author      : LiJunLe
// Version     : Accepted
// Copyright   : http://www.codeforces.com/contest/38/problem/B
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

bool map[10][10];

struct Node {
	int x, y;

	Node (int _x, int _y) :
		x(_x), y(_y) {}

	bool isLegal() {
		if (0 <= x && x < 8 && 0 <= y && y < 8) {
			return true;
		}
		else {
			return false;
		}
	}
};

int dx[9] = {0, -2, -2, -1, -1, +1, +1, +2, +2};
int dy[9] = {0, -1, +1, -2, +2, -2, +2, -1, +1};

void debug() {
	for (int i = 0; i < 8; i ++) {
		for (int j = 0; j < 8; j ++) {
			cout << map[i][j];
		}
		cout << endl;
	}
	cout << endl;
}

int main() {
	char posA[3];
	char posB[3];
	scanf("%s%s", posA, posB);
	memset(map, 0, sizeof(map));
	Node a(posA[0] - 'a', posA[1] - '1');
	Node b(posB[0] - 'a', posB[1] - '1');
	for (int i = 0; i <= 8; i ++) {
		Node t1(a.x + dx[i], a.y + dy[i]);
		Node t2(b.x + dx[i], b.y + dy[i]);
		if (t1.isLegal()) {
			map[t1.x][t1.y] = true;
		}
		if (t2.isLegal()) {
			map[t2.x][t2.y] = true;
		}
	}
	for (int i = 1; i <= 8; i ++) {
		if (a.x - i >= 0) {
			map[a.x-i][a.y] = true;
		}
		if (a.x + i < 8) {
			map[a.x+i][a.y] = true;
		}
		if (a.y - i >= 0) {
			map[a.x][a.y-i] = true;
		}
		if (a.y + i < 8) {
			map[a.x][a.y+i] = true;
		}
	}
	int cnt = 0;
	for (int i = 0; i < 8; i ++) {
		for (int j = 0; j < 8; j ++) {
			if (map[i][j] == false) {
				cnt ++;
			}
		}
	}
	printf("%d\n", cnt);
	return 0;
}