#include <bits/stdc++.h>
using namespace std;
long long a[100010];
map<long long, long long> mp;
int main() {
  int n, x, k;
  scanf("%d%d%d", &n, &x, &k);
  int num = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  if (k == 0) {
    sort(a + 1, a + n + 1);
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] % x == 0) continue;
      int v = ((a[i] / x) + 1) * x;
      long long p1 = upper_bound(a + 1, a + n + 1, v - 1) - a;
      long long p2 = lower_bound(a + 1, a + n + 1, a[i]) - a;
      ans += p1 - p2;
    }
    cout << ans << endl;
    return 0;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    mp[1ll * (a[i] + x - 1) / x * x]++;
    if (1ll * a[i] / x * x - 1ll * x * (k - 1) > 0)
      ans += mp[1ll * a[i] / x * x - 1ll * x * (k - 1)];
  }
  mp.clear();
  for (int i = n; i >= 1; i--) {
    if (1ll * a[i] / x * x - 1ll * x * (k - 1) > 0)
      ans += mp[a[i] / x * x - 1ll * x * (k - 1)];
    mp[1ll * (a[i] + x - 1) / x * x]++;
  }
  cout << ans << endl;
}
