public static ListNode deleteDuplicates(ListNode head) {
        if(head == null || head.next == null) return head;
        ListNode n = head;
        while(n != null && n.next != null){
            if(n.val == n.next.val)
                n.next = n.next.next;
            else
                n = n.next;
        }
        return head;
    }