#include <bits/stdc++.h>
using namespace std;
const int sz = 100005;
int a[sz];
int n, x, k;
long long cot, ans;
void get(int i, long long y) {
  int low, high, mid;
  low = i, high = n + 1;
  while (low < high) {
    mid = (low + high) / 2;
    if (a[mid] < y) {
      low = mid + 1;
    } else {
      high = mid;
    }
  }
  int r = low - 1;
  low = i, high = n + 1;
  while (low < high) {
    mid = (low + high) / 2;
    if (a[mid] >= y - x) {
      high = mid;
    } else {
      low = mid + 1;
    }
  }
  int l = high;
  int ret = 0;
  if (r >= l) {
    ret = r - l + 1;
  }
  cot += ret;
}
int main() {
  while (scanf("%d%d%d", &n, &x, &k) != EOF) {
    cot = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    a[n + 1] = 1000000005;
    sort(a + 1, a + 1 + n);
    if (k == 1) {
      long long tmp = 0, las = 0;
      for (int i = 1; i <= n; i++) {
        if (a[i] % x != 0) {
          cot += tmp * tmp - tmp * (tmp + 1) / 2;
          tmp = 0;
        } else {
          if (las == a[i]) {
            tmp++;
          } else {
            cot += tmp * tmp - tmp * (tmp + 1) / 2;
            las = a[i];
            tmp = 1;
          }
        }
      }
      cot += tmp * tmp - tmp * (tmp + 1) / 2;
    }
    if (k == 0) {
      long long tmp = 0, las = 0;
      for (int i = 1; i <= n; i++) {
        if (a[i] % x == 0) {
          cot += tmp * tmp - tmp * (tmp + 1) / 2;
          tmp = 0;
        } else {
          if (las == a[i]) {
            tmp++;
          } else {
            cot += tmp * tmp - tmp * (tmp + 1) / 2;
            las = a[i];
            tmp = 1;
          }
        }
      }
      cot += tmp * tmp - tmp * (tmp + 1) / 2;
    }
    for (int i = 1; i <= n; i++) {
      long long y = a[i];
      if (a[i] % x > 0) {
        y += x - a[i] % x;
      }
      y += (long long)k * (long long)(x);
      get(i, y);
    }
    cout << cot << endl;
  }
  return 0;
}
