#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
const int INF = 1e9 + 7;
int num[N];
map<int, int> cnt1;
map<pair<int, int>, int> cnt2;
int main() {
  int n, x, k;
  cin >> n >> x >> k;
  for (int i = 0; i < n; i++) {
    scanf("%d", &num[i]);
  }
  sort(num, num + n);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    cnt1[(num[i] - 1) / x]++;
    ans += cnt1[num[i] / x - k];
    ans += cnt2[{num[i] / x - k, num[i]}];
    cnt2[{(num[i] - 1) / x, num[i]}]++;
  }
  cout << ans;
  return 0;
}
