#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, k, x;
  cin >> n >> x >> k;
  vector<long long int> a(n);
  map<long long int, long long int> occur;
  for (long long int &u : a) {
    cin >> u;
    occur[u]++;
  }
  long long int cnt = 0;
  map<long long int, long long int> m;
  for (auto p : occur) {
    long long int val = p.first;
    long long int num = p.second;
    m[(val - 1) / x] += num;
    cnt += m[val / x - k] * num;
  }
  cout << cnt << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
