#include <bits/stdc++.h>
using namespace std;
long long a[100500];
int n;
int getInd(long long f) {
  int l = -1, r = n;
  while (r - l > 1) {
    int mid = (r + l) / 2;
    if (a[mid] >= f)
      r = mid;
    else
      l = mid;
  }
  return r;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long x, k;
  cin >> n >> x >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long long numb1;
    int ind1, ind2;
    if (k > 0) {
      numb1 = a[i] + (k - 1) * x + (a[i] % x == 0 ? 0 : x - (a[i] % x));
      ind1 = getInd(numb1);
      ind2 = getInd(numb1 + x);
    } else {
      if (a[i] % x == 0) continue;
      ind1 = getInd(a[i]);
      ind2 = getInd(a[i] + (x - a[i] % x));
    }
    ans += ind2 - ind1;
  }
  cout << ans;
  return 0;
}
