#include <bits/stdc++.h>
using namespace std;
int calc(int b, int x) { return b / x; }
int main() {
  ios::sync_with_stdio(false);
  long long rez = 0;
  int n, k, x;
  cin >> n >> x >> k;
  int ar[n];
  for (int ctr1 = 0; ctr1 < n; ++ctr1) cin >> ar[ctr1];
  sort(ar, ar + n);
  unordered_map<int, int> hm;
  for (int ctr1 = 0; ctr1 < n; ++ctr1) {
    int y = calc(ar[ctr1], x);
    ++hm[2 * y + (ar[ctr1] % x != 0)];
  }
  int total = 1;
  for (int ctr1 = 0; ctr1 < n; ++ctr1) {
    int y = calc(ar[ctr1], x);
    if (ar[ctr1] % x && k > 0)
      rez += hm[2 * (y + k)] + hm[2 * (y + k) + 1];
    else if (k > 0)
      rez += hm[2 * (y + k - 1)] + hm[2 * (y + k - 1) + 1];
    else
      rez += ar[ctr1] % x ? hm[2 * y + 1] : 0;
    if (ctr1 + 1 < n && ar[ctr1 + 1] != ar[ctr1]) {
      hm[2 * y + (ar[ctr1] % x != 0)] -= total;
      total = 0;
    }
    total++;
  }
  cout << rez << "\n";
  return 0;
}
