Preserving the Grid

Place d partitions between cells of a 1 by n board holding k horses to maximize cells no horse can reach.

Medium5GreedySortingInterviewNo attempts yetTime limit1sMemory limit32 MB

Problem

Seunghyun has a 1×n1 \times n grid board. Its cells are numbered 1 to nn from left to right. Exactly kk of the cells hold one horse each. A horse likes the board, so it visits every cell it can reach.

Seunghyun could not just watch the horses dirty his board, so he bought dd partitions. A partition goes on the line segment where two neighboring cells meet, at most one partition per segment, and a horse cannot cross a partition.

In the picture above, the horse on cell 5 visits cells 3, 4 and 5, and the horse on cell 8 visits cells 6, 7 and 8. The only preserved cells are cell 1 and cell 2.

Seunghyun wants to place the dd partitions so that the number of cells no horse visits is as large as possible. Help him by writing a program that finds the largest number of cells he can preserve.

Input

The first line contains the board size nn, the number of horses kk, and the number of partitions dd, separated by spaces.

The second line contains the integers p1,p2,,pkp_1, p_2, \ldots, p_k, separated by spaces. pip_i is the number of the cell that holds horse ii.

  • 2n1092 \le n \le 10^9
  • 1kmin(105,n)1 \le k \le \min(10^5, n)
  • 1dn11 \le d \le n - 1
  • 1p1<p2<<pkn1 \le p_1 < p_2 < \cdots < p_k \le n

Output

Print the largest number of cells that can be preserved when the dd partitions are placed well.