#include <bits/stdc++.h>
using namespace std;
int toNumber(string s) {
  int Number;
  if (!(istringstream(s) >> Number)) Number = 0;
  return Number;
}
string toString(int number) {
  ostringstream ostr;
  ostr << number;
  return ostr.str();
}
long long ele(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    return ele((a * a), b / 2);
  } else {
    return a * ele((a * a), b / 2);
  }
}
long long mcd(long long a, long long b) {
  if (a == 0) return b;
  return mcd(b % a, a);
}
double d_abs(long a, long b) {
  if (a > b) {
    return a - b;
  }
  return b - a;
}
void solve() {
  long long n, k, x;
  cin >> n >> x >> k;
  long long nums[n];
  for (int i = 0; i < (int)(n); i++) cin >> nums[i];
  sort(nums, nums + n);
  long long cant = 0;
  for (int i = 0; i < (int)(n); i++) {
    long long t = nums[i];
    long long primerMult = t / x;
    primerMult *= x;
    if (primerMult < t) primerMult += x;
    long long ultimo = primerMult + (k)*x;
    long long desde = ultimo - x;
    long long hasta = ultimo - 1;
    if (k == 0) {
      if (nums[i] % x == 0) {
        continue;
      } else {
        desde = nums[i];
        hasta = primerMult - 1;
      }
    }
    int lo = -1, hi = n;
    while (hi - lo > 1) {
      int mi = (lo + hi) / 2;
      if (nums[mi] >= desde) {
        hi = mi;
      } else {
        lo = mi;
      }
    }
    int primerIndice = hi;
    lo = -1, hi = n;
    while (hi - lo > 1) {
      int mi = (lo + hi) / 2;
      if (nums[mi] <= hasta) {
        lo = mi;
      } else {
        hi = mi;
      }
    }
    int lastInd = lo;
    if (lastInd == -1 || primerIndice == -1) continue;
    if (nums[lastInd] <= hasta && nums[primerIndice] >= desde) {
      cant += lastInd - primerIndice + 1;
    }
  }
  cout << cant << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T;
  T = 1;
  while (T--) {
    solve();
  }
}
