import java.io.IOException; import java.util.InputMismatchException; import java.util.TreeMap; import java.util.TreeSet; public class Main { void add(int key, int value, TreeMap map) { if (map.get(key) == null) { map.put(key, value); } else { map.put(key, map.get(key) + value); } } void run() { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int d = sc.nextInt(); int t = sc.nextInt(); int[] a = sc.nextIntArray(n); TreeMap> map = new TreeMap>(); for (int i = 0; i < n; i++) { int rem = a[i] % d; if (map.get(rem) == null) { TreeSet l = new TreeSet(); l.add(a[i]); map.put(rem, l); } else { map.get(rem).add(a[i]); } } long sum = 0; for (Integer key : map.keySet()) { TreeSet set = map.get(key); TreeMap array = new TreeMap(); for (Integer pos : set) { int l = pos - t * d; int r = pos + t * d; add(l, 1, array); add(r + d, -1, array); } //----------------------------------------------- // for (Integer k : array.keySet()) { // System.out.print(k + " "); // } // System.out.println(); // for (Integer k : array.keySet()) { // int v = array.get(k); // System.out.print(v + " "); // } // System.out.println(); //----------------------------------------------- int ameba = 0; int pre = -1; for (Integer pos : array.keySet()) { if (0 < ameba) { sum += (pos - pre) / d; } int value = array.get(pos); ameba += value; pre = pos; } } System.out.println(sum); } public static void main(String[] args) { new Main().run(); } public void mapDebug(int[][] a) { System.out.println("--------map display---------"); for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[i].length; j++) { System.out.printf("%3d ", a[i][j]); } System.out.println(); } System.out.println("----------------------------" + '\n'); } class MyScanner { int read() { try { return System.in.read(); } catch (IOException e) { throw new InputMismatchException(); } } boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } boolean isEndline(int c) { return c == '\n' || c == '\r' || c == -1; } int nextInt() { return Integer.parseInt(next()); } int[] nextIntArray(int n) { int[] array = new int[n]; for (int i = 0; i < n; i++) array[i] = nextInt(); return array; } long nextLong() { return Long.parseLong(next()); } long[] nextLongArray(int n) { long[] array = new long[n]; for (int i = 0; i < n; i++) array[i] = nextLong(); return array; } double nextDouble() { return Double.parseDouble(next()); } double[] nextDoubleArray(int n) { double[] array = new double[n]; for (int i = 0; i < n; i++) array[i] = nextDouble(); return array; } String next() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } String[] nextStringArray(int n) { String[] array = new String[n]; for (int i = 0; i < n; i++) array[i] = next(); return array; } String nextLine() { int c = read(); while (isEndline(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndline(c)); return res.toString(); } } }