#include <bits/stdc++.h>
using namespace std;
map<long long, long long> used;
int main() {
  int n;
  long long x, k;
  scanf("%d%I64d%I64d", &n, &x, &k);
  long long t;
  vector<long long> a;
  vector<long long> v;
  int i;
  long long ans = 0;
  for (i = 0; i < n; i++) {
    scanf("%I64d", &t);
    if (used.find(t) == used.end()) {
      a.push_back(t);
    }
    used[t]++;
    v.push_back(t);
  }
  sort(a.begin(), a.end());
  sort(v.begin(), v.end());
  if (k == 0) {
    for (auto it : a) {
      long long l, r;
      if (it % x == 0) {
        continue;
      }
      l = it;
      r = (l + x);
      r -= (r % x) + 1;
      long long li = lower_bound(v.begin(), v.end(), l) - v.begin();
      if (li == v.size()) {
        continue;
      }
      long long ri = upper_bound(v.begin(), v.end(), r) - v.begin() - 1;
      ans += (used[it] * (ri - li + 1));
    }
    printf("%I64d", ans);
    return 0;
  }
  for (auto it : a) {
    long long l, r;
    if (it % x == 0) {
      l = it + (x * (k - 1));
      r = l + x - 1;
    } else {
      l = it + (x * k);
      l -= (l % x);
      r = l + x - 1;
    }
    long long li = lower_bound(v.begin(), v.end(), l) - v.begin();
    if (li == v.size()) {
      continue;
    }
    long long ri = upper_bound(v.begin(), v.end(), r) - v.begin() - 1;
    ans += (used[it] * (ri - li + 1));
  }
  printf("%I64d", ans);
  return 0;
}
