#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e9;
const long double eps = 1e-9;
const long double pi = acos(-1);
const long long int mod = 1000000007;
long long int powmod(long long int a, long long int b) {
  long long int res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
int arr[100005];
map<int, int> ctlrange;
map<int, int> ctrrange;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, n, x, k;
  cin >> n >> x >> k;
  int lrange, rrange;
  long long int ans = 0;
  for (i = 0; i < n; ++i) {
    cin >> arr[i];
    lrange = (arr[i] - 1) / x;
    rrange = (arr[i]) / x;
    ctlrange[lrange]++;
    ctrrange[rrange]++;
  }
  if (k == 0) {
    sort(arr, arr + n);
    for (i = 0; i < n; ++i) {
      if (arr[i] % x == 0) continue;
      int lb = arr[i] / x;
      lb = lb * x;
      ans = ans + (upper_bound(arr, arr + n, arr[i]) -
                   lower_bound(arr, arr + n, lb + 1));
    }
    cout << ans << '\n';
    return 0;
  }
  for (i = 0; i < n; ++i) {
    lrange = (arr[i] - 1) / x;
    rrange = (arr[i]) / x;
    int finds = rrange - k;
    if (ctlrange.count(finds)) {
      auto it = ctlrange.find(finds);
      ans += it->second;
    }
  }
  cout << ans << '\n';
  return 0;
}
