```
def deleteDuplicates1(self, head):
node = head
while node and node.next:
if node.val == node.next.val:
node.next = node.next.next
else:
node = node.next
return head
def deleteDuplicates(self, head):
dic = {}
node = head
while node:
dic[node.val] = dic.get(node.val, 0) + 1
node = node.next
node = head
while node:
tmp = node
for _ in xrange(dic[node.val]):
tmp = tmp.next
node.next = tmp
node = node.next
return head
```