First Essex operates 20 banking offices in two counties in Massachusetts and three counties in southern New Hampshire .