#include <bits/stdc++.h>
int x, k;
int NumsBetween(int a, int b) { return (b / x - (a - 1) / x); }
int main() {
  int n;
  std::cin >> n >> x >> k;
  std::vector<int> array(n, 0);
  for (int i = 0; i < n; ++i) {
    std::cin >> array[i];
  }
  std::sort(array.begin(), array.end());
  long long answ = 0;
  int pointer = 0;
  int start = 0;
  int finish = 0;
  while (pointer < n) {
    for (; start < n; start += 1) {
      if (NumsBetween(array[pointer], array[start]) >= k) break;
    }
    for (; finish < n; finish += 1) {
      if (NumsBetween(array[pointer], array[finish]) > k) break;
    }
    answ += finish - start;
    pointer += 1;
    if (start != n && pointer != n && array[pointer] > array[start])
      start = pointer;
    if (finish != n && start != n && array[start] > array[finish])
      finish = start;
  }
  std::cout << answ << std::endl;
  return 0;
}
