#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
long long a[100006];
int main() {
  int n, x, k;
  while (~scanf("%d%d%d", &n, &x, &k)) {
    for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
    sort(a, a + n);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      int l = lower_bound(a, a + n, max(a[i], ((a[i] - 1) / x + k) * x)) - a;
      int r = upper_bound(a, a + n, ((a[i] - 1) / x + (k + 1)) * x - 1) - a - 1;
      sum += 1LL * (r - l + 1);
    }
    printf("%lld\n", sum);
  }
  return 0;
}
