Some $n>2$ lamps are cyclically connected: lamp $1$ with lamp $2$, ..., lamp $k$ with lamp $k+1$,..., lamp $n-1$ with lamp $n$, lamp $n$ with lamp $1$. At the beginning all lamps are off. When one pushes the switch of a lamp, that lamp and the two ones connected to it change status (from off to on, or vice versa). Determine the number of configurations of lamps reachable from the initial one, through some set of switches being pushed.
1. **Assigning Values to Lamps:**
   - Assign the value \(1\) to each *off* lamp and \(-1\) to each *on* lamp.
   - Let \(a_i\) be \(1\) if lamp \(i\) is switched an even number of times, and \(-1\) if it is switched an odd number of times.

2. **Effect of Switching:**
   - When a lamp \(i\) is switched, it affects the status of lamp \(i\) and its two neighbors \(i-1\) and \(i+1\).
   - The final status of lamp \(i\) will be \(a_{i-1}a_ia_{i+1}\).

3. **Desired Configuration:**
   - Let the desired configuration be \(\varepsilon_1, \varepsilon_2, \ldots, \varepsilon_n\) where \(\varepsilon_i \in \{-1, 1\}\).
   - We need to solve the system of equations:
     \[
     a_1a_2a_3 = \varepsilon_1, \quad a_2a_3a_4 = \varepsilon_2, \quad \ldots, \quad a_na_1a_2 = \varepsilon_n
     \]

4. **Solving the System:**
   - From the equations, we can express \(a_4, a_5, \ldots\) in terms of \(a_1, a_2, a_3\):
     \[
     a_4 = \frac{\varepsilon_2}{\varepsilon_1}a_1, \quad a_5 = \frac{\varepsilon_3}{\varepsilon_2}a_2, \quad a_6 = \frac{\varepsilon_4}{\varepsilon_3}a_3, \quad \ldots
     \]
   - In general, \(a_k = \frac{\varepsilon_{k-2}}{\varepsilon_{k-3}}a_{k-3}\).

5. **Modulo 3 Residue:**
   - The general form can be written as \(a_k = t_k a_r\) where \(r\) is the residue of \(k\) modulo 3 and \(t_k \in \{1, -1\}\).
   - This implies that once \(a_1, a_2, a_3\) are fixed, the other \(a_i\)s are uniquely determined.

6. **Special Cases:**
   - **Case 1: \(n \equiv 1 \pmod{3}\)**
     - We need to solve:
       \[
       a_{n-1}a_na_1 = \varepsilon_{n-1} \quad \text{and} \quad a_na_1a_2 = \varepsilon_n
       \]
     - Substituting the general form:
       \[
       a_{n-1} = t_{n-1}a_2, \quad a_n = t_na_3
       \]
     - This gives:
       \[
       t_{n-1}t_na_1a_2a_3 = \varepsilon_{n-1} \quad \text{and} \quad t_na_1a_2a_3 = \varepsilon_n
       \]
     - Choosing \(a_1 = \varepsilon_1a_2a_3\), we can find a solution.

   - **Case 2: \(n \equiv 2 \pmod{3}\)**
     - Similar steps can be followed to find a solution.

   - **Case 3: \(n \equiv 0 \pmod{3}\)**
     - We have:
       \[
       a_n = t_na_3, \quad a_{n-1} = t_{n-1}a_2
       \]
     - This implies:
       \[
       \varepsilon_{n-1} = t_{n-1}t_na_1a_2a_3 = t_{n-1}t_n\varepsilon_1 \quad \text{and} \quad \varepsilon_n = t_na_1a_2a_3 = t_n\varepsilon_1
       \]
     - Thus, \(\varepsilon_{n-1}\) and \(\varepsilon_n\) depend on the other \(n-2\) values.

7. **Conclusion:**
   - If \(n\) is not divisible by 3, any configuration can be reached, so the number of configurations is \(2^n\).
   - If \(n\) is divisible by 3, we can choose \(\varepsilon_1, \ldots, \varepsilon_{n-2}\) freely, and \(\varepsilon_{n-1}, \varepsilon_n\) are uniquely determined, so the number of configurations is \(2^{n-2}\).

The final answer is \( \boxed{ 2^n } \) if \(n\) is not divisible by 3, and \(2^{n-2}\) if \(n\) is divisible by 3.