#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  long long i, j, n, m, x, k;
  cin >> n >> x >> k;
  vector<long long> v;
  for (i = 0; i < n; i++) {
    long long o;
    cin >> o;
    v.push_back(o);
  }
  sort(v.begin(), v.end());
  long long count = 0;
  for (i = 0; i < n; i++) {
    long long temp = v[i] % x;
    vector<long long>::iterator ns, ne;
    if (k == 0) {
      if (temp == 0) {
        ns = v.begin();
        ne = v.begin();
      } else {
        ns = lower_bound(v.begin(), v.end(), v[i]);
        ne = upper_bound(v.begin(), v.end(), v[i] + (x - temp) - 1);
      }
    } else {
      if (temp == 0) {
        ns = lower_bound(v.begin(), v.end(), v[i] + (k - 1) * x);
        ne = upper_bound(v.begin(), v.end(), v[i] + k * x - 1);
      } else {
        ns = lower_bound(v.begin(), v.end(), v[i] + (k - 1) * x + x - temp);
        ne = upper_bound(v.begin(), v.end(), v[i] + k * x - 1 + x - temp);
      }
    }
    count += ne - ns;
  }
  cout << count;
  return 0;
}
