#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 1e5;
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
ll pwr(ll x, ll n) {
  if (!n) return 1;
  if (n & 1)
    return mul(x, pwr(mul(x, x), (n - 1) / 2));
  else
    return pwr(mul(x, x), n / 2);
}
ll modinv(ll n) { return pwr(n, mod - 2); }
void speed_solve() {
  ll n, x, k;
  cin >> n >> x >> k;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    if (a[i] % x) {
      ll first = (a[i] / x + k) * x;
      ll last = (a[i] / x + k + 1) * x;
      ll lbf = lower_bound(a.begin(), a.end(), max(first, a[i])) - a.begin();
      ll lbl = lower_bound(a.begin(), a.end(), last) - a.begin();
      ans += lbl - lbf;
    } else {
      ll first = (a[i] / x + k - 1) * x;
      ll last = (a[i] / x + k) * x;
      ll lbf = lower_bound(a.begin(), a.end(), max(first, a[i])) - a.begin();
      ll lbl = lower_bound(a.begin(), a.end(), last) - a.begin();
      ans += lbl - lbf;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll test_cases = 1;
  for (ll i = 0; i < test_cases; i++) {
    speed_solve();
  }
  return 0;
}
