public ListNode deleteDuplicates(ListNode head) {
        ListNode dummy = new ListNode(0);
        dummy.next = head;
        ListNode p = dummy;

        if(head == null) return head;
        int cur = head.val+1;
        while(p.next != null){
            if(p.next.val != cur){
                cur = p.next.val;
                p = p.next;
            }else{
                p.next = p.next.next;
            }
        }
        return dummy.next;
    }