Some time ago there was a war across the world. In the plane $n$ lines are moving, with the regions contained by the lines being the territories of the countries at war. Each line moves parallel to itself with constant speed (each with its own speed), and no line can reverse its direction. Some of the original countries disappeared (a country disappears iff its area is converted to zero) and within the course of the time, other countries appeared.

After some time, the presidents of the existing countries made a treaty to end the war, created the United Nations, and all borders ceased movement. The UN then counted the total numbers of sovereign states that were destroyed and the existing ones, obtaining a total of $k$.

Prove that $k\leq \frac{n^3+5n}{6}+1$. Is is possible to have equality?
1. **Embedding the Plane in $\mathbb{R}^3$**:
   - Consider the plane $\mathbb{R}^2$ where the $n$ lines are moving. Embed this plane in $\mathbb{R}^3$ and make the plane move in a direction perpendicular to itself with constant speed. This means that each line in the plane traces out a plane in $\mathbb{R}^3$.

2. **Counting Regions in $\mathbb{R}^3$**:
   - The total number of countries (regions) in the plane is at most the number of regions into which $\mathbb{R}^3$ is divided by the $n$ planes. This is because each moving line in $\mathbb{R}^2$ corresponds to a plane in $\mathbb{R}^3$.

3. **Induction on the Number of Planes**:
   - We use induction to determine the maximum number of regions into which $\mathbb{R}^3$ can be divided by $n$ planes.
   - **Base Case**: For $n=0$, there is only one region, the whole space itself.
   - **Inductive Step**: Assume that $k$ planes divide $\mathbb{R}^3$ into at most $\frac{k^3 + 5k}{6} + 1$ regions. When we add the $(k+1)$-th plane, it can intersect each of the $k$ existing planes in a line. Each of these lines can divide a region into two, adding at most the number of regions a plane can be divided into by $k$ lines.

4. **Maximum Number of Regions in $\mathbb{R}^2$**:
   - It is well known that the maximum number of regions a plane can be divided into by $n$ lines is $\frac{n(n+1)}{2} + 1$. This can be proved using induction:
     - **Base Case**: For $n=0$, there is 1 region.
     - **Inductive Step**: Assume $k$ lines divide the plane into $\frac{k(k+1)}{2} + 1$ regions. Adding the $(k+1)$-th line can intersect each of the $k$ lines in a new point, creating $k+1$ new regions. Thus, the total number of regions is $\frac{k(k+1)}{2} + 1 + (k+1) = \frac{(k+1)(k+2)}{2} + 1$.

5. **Summing Up the Regions**:
   - With each new plane in $\mathbb{R}^3$, the number of new regions is at most the maximum number of regions for the corresponding problem in the plane. Therefore, we get at most:
     \[
     1 + \sum_{i=0}^{n-1} \left( \frac{i(i+1)}{2} + 1 \right)
     \]
   - Simplifying the sum:
     \[
     \sum_{i=0}^{n-1} \left( \frac{i(i+1)}{2} + 1 \right) = \sum_{i=0}^{n-1} \frac{i(i+1)}{2} + \sum_{i=0}^{n-1} 1
     \]
     \[
     = \frac{1}{2} \sum_{i=0}^{n-1} i(i+1) + n
     \]
     \[
     = \frac{1}{2} \sum_{i=0}^{n-1} (i^2 + i) + n
     \]
     \[
     = \frac{1}{2} \left( \sum_{i=0}^{n-1} i^2 + \sum_{i=0}^{n-1} i \right) + n
     \]
     Using the formulas for the sums of squares and integers:
     \[
     \sum_{i=0}^{n-1} i^2 = \frac{(n-1)n(2n-1)}{6}, \quad \sum_{i=0}^{n-1} i = \frac{(n-1)n}{2}
     \]
     \[
     = \frac{1}{2} \left( \frac{(n-1)n(2n-1)}{6} + \frac{(n-1)n}{2} \right) + n
     \]
     \[
     = \frac{1}{2} \left( \frac{(n-1)n(2n-1) + 3(n-1)n}{6} \right) + n
     \]
     \[
     = \frac{1}{2} \left( \frac{(n-1)n(2n+2)}{6} \right) + n
     \]
     \[
     = \frac{1}{2} \left( \frac{(n-1)n(2n+2)}{6} \right) + n
     \]
     \[
     = \frac{(n-1)n(n+1)}{6} + n
     \]
     \[
     = \frac{n^3 - n}{6} + n
     \]
     \[
     = \frac{n^3 + 5n}{6}
     \]
   - Adding the initial region:
     \[
     1 + \frac{n^3 + 5n}{6}
     \]

6. **Conclusion**:
   - Therefore, the maximum number of regions is:
     \[
     k \leq \frac{n^3 + 5n}{6} + 1
     \]
   - Equality is attained if no four planes intersect in one point and all the different regions are in the half-space corresponding to positive time.

The final answer is \( \boxed{ k \leq \frac{n^3 + 5n}{6} + 1 } \)