n,d,t=map(int, raw_input().split()) dic=dict() for i in map(int,raw_input().split()): j=(i%d+d)%d if j in dic: dic[j].append(i) else: dic[j]=[i] res=0 for k,v in dic.items(): v.sort() res+=len(v)+t*2 for i in xrange(len(v)-1): if v[i]+t*d