# 2. Option 1

Given a rectangular grid. We will call two cells adjacent if they share a side. Let's count the number of cells that have exactly four adjacent cells. It turned out to be 23. How many cells have exactly three adjacent cells?
Answer: 48.

Solution. Let $a$ and $b$ be the sides of the rectangle. The total number of cells that have exactly 4 neighbors by side is $(a-2)(b-2)$, and on the other hand, there are 23 such cells. Since 23 is a prime number, the numbers $a-2$ and $b-2$ are equal to the numbers 1 and 23 in some order. The number of cells that have exactly three neighbors is $2(a-2+b-2)$. Therefore: $2(1+23)=48$.

## Variant 2

Given a grid rectangle. We will call two cells neighboring if they share a side. Let's count the number of cells that have exactly four neighboring cells by side. It turned out to be 29. How many cells have three neighboring cells?

Answer: 60.

## Variant 3

Given a grid rectangle. We will call two cells neighboring if they share a side. Let's count the number of cells that have exactly four neighboring cells by side. It turned out to be 31. How many cells have three neighboring cells?

Answer: 64.

## Variant 4

Given a grid rectangle. We will call two cells neighboring if they share a side. Let's count the number of cells that have exactly four neighboring cells by side. It turned out to be 53. How many cells have three neighboring cells?

Answer: 108.

## Variant 5

Given a grid rectangle. We will call two cells neighboring if they share a side. Let's count the number of cells that have exactly four neighboring cells by side. It turned out to be 59. How many cells have three neighboring cells?

Answer: 120.