Under construction

Still being built. Things may change

Birds on a Wire

Interview

Time limit1sMemory limit256 MB

Summary
Count how many more birds can sit on a wire of length l when birds stay d apart and 6 cm from each pole.
Level

Easy3 of 10

Topics
Greedy, Sorting, Math
Solved
No attempts yet

Problem

An electrical wire of length ℓ\ell centimetres hangs between two poles, and birds like to sit on it. Watching them from your balcony after work, you notice two habits. The birds never sit closer than dd centimetres to each other. The poles carry spikes that keep faeces from damaging the wood, so no bird sits closer than 6 centimetres to either pole.

You are given the length ℓ\ell, the distance dd, and the positions of the birds already on the wire. Find how many more birds can sit on the wire. Assume the birds have zero width.

Input

The first line contains three space separated integers: the length of the wire ℓ\ell, the distance dd, and the number nn of birds already sitting on the wire.

Each of the next nn lines contains the position of one bird, in any order. A position is the distance measured from one pole, and the answer is the same whichever pole you measure from.

All numbers are integers with 1≤ℓ,d≤1 000 000 0001 \le \ell, d \le 1\,000\,000\,000 and 0≤n≤20 0000 \le n \le 20\,000. The birds already on the wire are at least 6 centimetres from both poles and at least dd centimetres apart from each other.

If you object to fitting that many birds on a line hanging between two poles, you may imagine that the line is 0 centimetres above ground level, or that the birds are ants.

Output

Print one line with one integer: the maximal number of additional birds that can sit on the wire.

Examples2

  1. Example 1

    Input
    22 2 2
    11
    9
    
    Expected output
    3
    
  2. Example 2

    Input
    47 5 0
    
    Expected output
    8