#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long int n, x, k;
  cin >> n >> x >> k;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    long long int ll, ul;
    if (k == 0) {
      if (a[i] % x == 0) {
        continue;
      }
      ll = a[i];
      ul = (x - a[i] % x) % x + a[i] - 1;
    } else {
      ll = a[i] + (x - a[i] % x) % x + (k - 1) * x;
      ul = ll + x - 1;
    }
    int f = lower_bound(a, a + n, ll) - a;
    int s = upper_bound(a, a + n, ul) - a - 1;
    ans += max(0, s - f + 1);
  }
  cout << ans << endl;
}
