In any finite grid of squares, some shaded and some not, for each unshaded square, record the number of shaded squares horizontally or vertically adjacent to it; this grid's [i]score[/i] is the sum of all numbers recorded this way. Deyuan shades each square in a blank  $n\times n$ grid with probability $k$; he notices that the expected value of the score of the resulting grid is equal to $k$, too! Given that $k > 0.9999$, find the minimum possible value of $n$.

[i]Proposed by Andrew Wu[/i]
1. **Understanding the Problem:**
   We need to find the minimum value of \( n \) such that the expected score of an \( n \times n \) grid, where each square is shaded with probability \( k \) and \( k > 0.9999 \), is equal to \( k \).

2. **Score Calculation:**
   The score of the grid is defined as the sum of the number of shaded squares horizontally or vertically adjacent to each unshaded square. This can be interpreted as the number of pairs of adjacent squares with opposite colors.

3. **Expected Score Calculation:**
   The expected score of the grid is the expected number of pairs of adjacent squares with opposite colors. By the Linearity of Expectation, we can calculate this as follows:
   - There are \( 2n(n-1) \) pairs of adjacent squares in an \( n \times n \) grid (considering both horizontal and vertical pairs).
   - Each pair can be either (shaded, unshaded) or (unshaded, shaded), giving us 2 ways.
   - The probability of a pair being (shaded, unshaded) is \( k(1-k) \).

   Therefore, the expected score \( E \) is:
   \[
   E = 2n(n-1) \cdot 2 \cdot k(1-k)
   \]

4. **Setting Up the Equation:**
   Given that the expected score is equal to \( k \), we have:
   \[
   4n(n-1)k(1-k) = k
   \]

5. **Simplifying the Equation:**
   Dividing both sides by \( k \) (since \( k > 0 \)):
   \[
   4n(n-1)(1-k) = 1
   \]

6. **Substituting \( k \):**
   Given \( k > 0.9999 \), we substitute \( k = \frac{9999}{10000} \):
   \[
   4n(n-1)\left(1 - \frac{9999}{10000}\right) = 1
   \]
   Simplifying inside the parentheses:
   \[
   4n(n-1) \cdot \frac{1}{10000} = 1
   \]

7. **Solving for \( n \):**
   \[
   4n(n-1) = 10000
   \]
   Solving this quadratic equation:
   \[
   n(n-1) = 2500
   \]
   \[
   n^2 - n - 2500 = 0
   \]

8. **Finding the Roots:**
   Using the quadratic formula \( n = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \):
   \[
   n = \frac{1 \pm \sqrt{1 + 4 \cdot 2500}}{2}
   \]
   \[
   n = \frac{1 \pm \sqrt{10001}}{2}
   \]
   Approximating the square root:
   \[
   n \approx \frac{1 \pm 100.005}{2}
   \]
   Taking the positive root:
   \[
   n \approx \frac{101.005}{2} \approx 50.5025
   \]

9. **Determining the Minimum Integer \( n \):**
   Since \( n \) must be an integer, we round up to the next whole number:
   \[
   n = 51
   \]

The final answer is \( \boxed{51} \).