#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn];
long long binary_searchs(long long l, long long r, long long key) {
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (a[mid] >= key)
      r = mid - 1;
    else
      l = mid + 1;
  }
  return l;
}
int main() {
  long long n, x, k;
  cin >> n >> x >> k;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  sort(a, a + n);
  for (long long i = 0; i < n; i++) {
    long long t = a[i] % x;
    long long l = a[i] + (x - t) % x + (k - 1) * x;
    long long r = l + x;
    if (!k) {
      l = a[i];
      r = a[i] + (x - t) % x;
    }
    l = binary_searchs(0, n - 1, l);
    r = binary_searchs(0, n - 1, r);
    ans += r - l;
  }
  cout << ans << '\n';
  return 0;
}
