The function $g$ is defined about the natural numbers and satisfies the following conditions: 
$g(2) = 1$
$g(2n) = g(n)$
$g(2n+1) = g(2n) +1.$
Where $n$ is a natural number such that $1 \leq n \leq 2002$. 

Find the maximum value $M$ of $g(n).$ Also, calculate how many values of $n$ satisfy the condition of $g(n) = M.$
1. **Understanding the function \( g(n) \)**:
   - Given conditions:
     \[
     g(2) = 1
     \]
     \[
     g(2n) = g(n)
     \]
     \[
     g(2n+1) = g(2n) + 1
     \]
   - We claim that \( g(n) \) is equal to the number of ones in the binary representation of \( n \).

2. **Base cases**:
   - For \( n = 1 \):
     \[
     g(1) = 1 \quad \text{(since \( 1 \) in binary is \( 1 \))}
     \]
   - For \( n = 2 \):
     \[
     g(2) = 1 \quad \text{(since \( 2 \) in binary is \( 10 \))}
     \]
   - For \( n = 3 \):
     \[
     g(3) = g(2 \cdot 1 + 1) = g(2) + 1 = 1 + 1 = 2 \quad \text{(since \( 3 \) in binary is \( 11 \))}
     \]

3. **Inductive step**:
   - Assume \( g(n) \) is the number of ones in the binary representation of \( n \) for all \( n \) from \( 2^k \) to \( 2^{k+1} - 1 \).
   - Consider \( m \) such that \( 2^{k+1} \leq m < 2^{k+2} \):
     - If \( m \) is even, \( m = 2n \):
       \[
       g(m) = g(2n) = g(n)
       \]
       - Multiplying by 2 in binary adds a zero to the end, so \( m \) and \( n \) have the same number of ones.
     - If \( m \) is odd, \( m = 2n + 1 \):
       \[
       g(m) = g(2n + 1) = g(2n) + 1 = g(n) + 1
       \]
       - Adding 1 to an even number in binary changes the last zero to one, increasing the number of ones by 1.

4. **Maximum value \( M \)**:
   - The maximum value of \( g(n) \) for \( 1 \leq n \leq 2002 \) is the maximum number of ones in the binary representation of any number in this range.
   - The binary representation of 2002 is \( 11111010010_2 \), which has 7 ones.
   - The maximum number of ones in a binary number less than \( 2^{11} = 2048 \) is 11 (since \( 2047 = 11111111111_2 \)).

5. **Counting values of \( n \) for \( g(n) = 11 \)**:
   - Numbers with 11 ones in their binary representation and less than 2002:
     - \( 2047 \) is the smallest number with 11 ones, but it is greater than 2002.
     - Therefore, no number \( n \) in the range \( 1 \leq n \leq 2002 \) has 11 ones in its binary representation.

Conclusion:
\[
\boxed{M = 10}
\]
\[
\boxed{0}
\]