#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, k;
  scanf("%lld %lld %lld", &n, &x, &k);
  map<long long, long long> mp;
  map<long long, long long>::iterator itr, itp;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  sort(a, a + n);
  long long count = 0;
  for (int i = 0; i < n; i++) {
    long long lo, hi, mid;
    lo = -1;
    hi = n;
    long long lowerb, upperb;
    while (hi - lo > 1) {
      mid = (lo + hi) / 2;
      if (a[mid] <
          max(a[i], (long long)ceil((long double)a[i] / x) * x + (k - 1) * x)) {
        lo = mid;
      } else {
        hi = mid;
      }
    }
    lowerb = lo;
    lo = -1;
    hi = n;
    while (hi - lo > 1) {
      mid = (lo + hi) / 2;
      if (a[mid] <= ceil((long double)a[i] / x) * x + k * x - 1) {
        lo = mid;
      } else {
        hi = mid;
      }
    }
    upperb = lo;
    if (upperb >= lowerb) {
      count = count + (upperb - lowerb);
    }
  }
  printf("%lld\n", count);
}
