#include <bits/stdc++.h>
using namespace std;
long long arr1[100008], arr2[100008];
int main(void) {
  int i, n;
  int l, m, r, l0, left, right;
  long long x, k, a, t, b, lower, upper, num;
  cin >> n >> x >> k;
  for (i = 1; i <= n; i++) {
    scanf("%lld", &arr1[i]);
  }
  memcpy(arr2, arr1, sizeof arr1);
  sort(arr2 + 1, arr2 + n + 1);
  num = 0;
  for (i = 1; i <= n; i++) {
    l = 1, r = n;
    while (l < r) {
      m = l + (r - l) / 2;
      if (arr2[m] < arr1[i]) {
        l = m + 1;
      } else {
        r = m;
      }
    }
    l0 = l;
    a = arr2[l0];
    t = a / x;
    b = a % x;
    if (k == 0) {
      if (b == 0) {
        lower = t * x + 1;
        upper = (t + 1) * x - 1;
      } else {
        lower = a;
        upper = (t + 1) * x - 1;
      }
    } else {
      if (b == 0) {
        lower = (t + k - 1) * x;
        upper = (t + k) * x - 1;
      } else {
        lower = (t + k) * x;
        upper = (t + k + 1) * x - 1;
      }
    }
    if (lower > arr2[n]) {
      continue;
    }
    l = l0, r = n;
    while (l < r) {
      m = l + (r - l) / 2;
      if (arr2[m] < lower) {
        l = m + 1;
      } else {
        r = m;
      }
    }
    left = l;
    l = l0, r = n;
    while (l < r) {
      m = l + (r - l + 1) / 2;
      if (arr2[m] > upper) {
        r = m - 1;
      } else {
        l = m;
      }
    }
    right = l;
    num += right - left + 1;
  }
  printf("%lld\n", num);
  return 0;
}
