#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
long long int a[M], x, k, c[M], f[M], n, ans;
int main() {
  cin >> n >> x >> k;
  for (long long int i = 1; i <= n; i++) scanf("%lld", a + i);
  sort(a + 1, a + n + 1);
  f[1] = 1;
  for (int i = 2; i <= n; i++)
    if (a[i] == a[i - 1])
      f[i] = f[i - 1];
    else
      f[i] = i;
  for (long long int i = 1; i <= n; i++) {
    long long int c;
    if (a[i] % x == 0ll)
      c = a[i];
    else
      c = (a[i] / x) * x + x;
    long long int e = c + x * k;
    long long int d = e - x;
    long long int l = f[i] - 1, r = n + 1, mid;
    while (r - l > 1) {
      mid = (l + r) / 2;
      if (a[mid] < d)
        l = mid;
      else
        r = mid;
    }
    long long int lef = l;
    l = f[i] - 1, r = n + 1;
    while (r - l > 1) {
      mid = (l + r) / 2;
      if (a[mid] < e)
        l = mid;
      else
        r = mid;
    }
    ans += (l - lef);
  }
  cout << ans << endl;
  return 0;
}
