#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10;
const long long mod = 1e9 + 7;
int a[N];
map<int, int> pre;
int n, k, x;
int cal(int f) { return f / x; }
int main() {
  scanf("%d%d%d", &n, &x, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int e1 = 0, e2 = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!pre[a[i]]) pre[a[i]] = i;
    while (e1 + 1 <= n && cal(a[e1 + 1]) - cal(a[i] - 1) <= k) {
      e1++;
    }
    e1 = max(e1, i);
    while (e2 + 1 <= n && cal(a[e2 + 1]) - cal(a[i] - 1) < k) {
      e2++;
    }
    e2 = max(e2, pre[a[i]] - 1);
    if (cal(a[e1]) - cal(a[i] - 1) == k) ans += (e1 - e2);
  }
  printf("%lld\n", ans);
  return 0;
}
