#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <unordered_set>
#include <map>
#include <utility>
#include <set>
#include <unordered_map>
#include <climits>
#include <cmath>
#include <stack>
#include <string>
using namespace std ;
#define ll long long int
#define IOS ios::sync_with_stdio(false) ; cin.tie(0) ; cout.tie()
#define MOD 1000000007
int arr[100005] ;
//ll n ;
int main(){
IOS;
ll n ,x , k;
cin>>n>>x>>k ;
for(ll i = 0 ; i< n ; ++i)
{
cin>>arr[i];
}
sort(arr , arr + n ) ;
ll ans = 0 ;
ll modulo[n] ;
for(int i = 0 ; i< n ; ++i)
{
modulo[i] = arr[i] / x ;
}
for(int i = 0 ; i< n ;++i)
{
if(arr[i] % x != 0){
auto k1 = lower_bound(modulo , modulo + n , modulo[i] + k) ;
auto k2 = upper_bound(modulo , modulo + n , modulo[i] + k) ;
ans += (k2 - k1 );
}
else
{
auto k1 = lower_bound(modulo , modulo + n , modulo[i] + k -1) ;
auto k2 = upper_bound(modulo , modulo + n , modulo[i] + k -1) ;
ans += (k2 - k1) ;
}
}
cout<<ans ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8cXVldWU+CiNpbmNsdWRlIDx1bm9yZGVyZWRfc2V0PgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPHVub3JkZXJlZF9tYXA+CiNpbmNsdWRlIDxjbGltaXRzPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxzdGFjaz4KI2luY2x1ZGUgPHN0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZCA7CiNkZWZpbmUgbGwgbG9uZyBsb25nIGludCAKI2RlZmluZSBJT1MgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpICA7IGNpbi50aWUoMCkgOyBjb3V0LnRpZSgpICAK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