n,d,t=map(int, raw_input().split()) dic={} 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(): res+=len(v)+t*2 for i in xrange(len(v)-1): if v[i]+t*d