#include <bits/stdc++.h>
using namespace std;
int cum[200000];
int main() {
  int n, x, k;
  cin >> n >> x >> k;
  int arr[n + 10];
  set<int> st;
  map<int, int> pos;
  int now = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    st.insert(arr[i]);
  }
  for (set<int>::iterator it = st.begin(); it != st.end(); it++) {
    pos[*it] = ++now;
  }
  for (int i = 1; i <= n; i++) {
    cum[pos[arr[i]]]++;
  }
  for (int i = 1; i <= now; i++) {
    cum[i] += cum[i - 1];
  }
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    long long pres = arr[i];
    long long first, lst;
    if (k > 0) {
      pres = arr[i];
      if (arr[i] % x != 0) pres = pres + (x - (arr[i] % x));
      pres += (k - 1) * 1LL * x;
      first = pres;
      lst = pres + x - 1;
    } else {
      pres = arr[i];
      if (arr[i] % x != 0) pres = pres + (x - (arr[i] % x));
      first = arr[i];
      lst = pres - 1;
    }
    if (*st.rbegin() < lst)
      lst = *st.rbegin();
    else {
      if (st.find(lst) == st.end()) {
        set<int>::iterator it = (st.upper_bound(lst));
        it--;
        lst = *it;
      }
    }
    if (*st.rbegin() < first)
      first = lst + 10;
    else {
      if (st.find(first) == st.end()) {
        set<int>::iterator it = (st.upper_bound(first));
        first = *it;
      }
    }
    if (lst >= first) {
      res += (cum[pos[lst]] - cum[pos[first] - 1]);
    }
  }
  cout << res << endl;
}
