#include <bits/stdc++.h>
using namespace std;
vector<int> prime;
void sieve() {
  int prime_number[1000000] = {0};
  for (int i = 2; i * i < 1000000; i++) {
    if (prime_number[i] != 1) {
      for (int j = 2; j * i < 1000000; j++) {
        prime_number[i * j] = 1;
      }
    }
  }
  for (int i = 2; i < 1000000; i++) {
    if (prime_number[i] == 0) prime.push_back(i);
  }
}
long long bin_expo(long long A, long long B, long long M) {
  if (B == 0) return 1;
  if (B % 2 == 1) {
    long long x = bin_expo(A, (B - 1) / 2, M);
    x = (x * x) % M;
    return (x * A) % M;
  } else {
    long long x = bin_expo(A, B / 2, M);
    return (x * x) % M;
  }
}
unordered_map<long long, long long> mp;
vector<long long> v;
long long suma[1000];
int main() {
  long long n, x, k;
  cin >> n >> x >> k;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    v.push_back(arr[i]);
  }
  sort(arr, arr + n);
  sort(v.begin(), v.end());
  for (int i = 0; i < n; i++) {
    v[i] = v[i] / x;
  }
  long long cnt = 0;
  for (int i = 0; i < n; i++) {
    long long idx =
        lower_bound(v.begin() + i, v.end(),
                    ((arr[i] % x == 0) ? (k + v[i] - 1) : (k + v[i]))) -
        v.begin();
    long long idx1 =
        upper_bound(v.begin() + i, v.end(),
                    ((arr[i] % x == 0) ? (k + v[i] - 1) : (k + v[i]))) -
        v.begin();
    if (idx < 0 || idx >= n) {
      continue;
    }
    if (mp.find(arr[i]) != mp.end()) {
      cnt += (mp[arr[i]]);
      continue;
    }
    cnt += (idx1 - idx);
    mp[arr[i]] = (idx1 - idx);
  }
  cout << cnt << endl;
  return 0;
}
