#include <bits/stdc++.h>
using namespace std;
const int lim = (int)(1e5 + 5);
using namespace std;
long long int n, x, k, ar[lim];
long long int ans;
map<long long int, long long int> mp, mp2;
int main() {
  scanf("%lld %lld %lld", &n, &x, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &ar[i]);
  sort(ar + 1, ar + n + 1);
  for (int i = n; i >= 1; i--) {
    long long int a = ar[i] / x;
    mp[a]++;
    mp2[ar[i]]++;
    long long int a2 = a + k;
    if (ar[i] % x == 0) a2--;
    ans += mp[a2];
  }
  map<long long int, long long int>::iterator it;
  for (it = mp2.begin(); it != mp2.end(); it++)
    if ((k == 0 && it->first % x != 0) || (k == 1 && it->first % x == 0))
      ans += it->second * ((it->second) - 1) / 2;
  printf("%lld\n", ans);
}
