#include <bits/stdc++.h>
using namespace std;
const long long int infinity = 9e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, x, k;
  cin >> n >> x >> k;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  long long int st, end, total = 0;
  for (int i = 0; i < n; i++) {
    end = v[i] + ((v[i] % x) != 0) * (x - (v[i] % x)) + k * x - 1;
    st = max(v[i], end + 1 - x);
    if (v.back() < st) continue;
    long long int idx1 = lower_bound(v.begin(), v.end(), st) - v.begin();
    long long int idx2 = 0;
    if (v.back() <= end) {
      idx2 = n - 1;
    } else {
      idx2 = upper_bound(v.begin(), v.end(), end) - v.begin();
      idx2--;
    }
    total += (idx2 - idx1 + 1);
  }
  cout << total;
  return 0;
}
