def get_observable_positions(x, y): directions = [ (2, -1), (2, 1), (-2, -1), (-2, 1), (-1, -2), (1, -2), (-1, 2), (1, 2) ] observable_positions = set() for dx, dy in directions: observable_positions.add((x + dx, y + dy)) return observable_positions # 入力の読み込み N = int(input().strip()) umas = [tuple(map(int, input().strip().split())) for _ in range(N)] uma_positions = set(umas) # すべての監視装置の配置場所を候補とする all_positions = set() for x, y in umas: all_positions.update(get_observable_positions(x, y)) # UMAの位置は監視装置を設置できないので除外する all_positions -= uma_positions # 監視装置のリスト all_positions = list(all_positions) # DFSによるバックトラッキング def dfs(covered, kma_count, index): global min_kma_count if kma_count >= min_kma_count: return if covered == uma_positions: min_kma_count = kma_count return for i in range(index, len(all_positions)): new_covered = covered | get_observable_positions(*all_positions[i]) dfs(new_covered, kma_count + 1, i + 1) min_kma_count = float('inf') dfs(set(), 0, 0) print(min_kma_count)