public ListNode rotateRight(ListNode head, int n) {
 
    	if(head == null) return head;
    	
    	// get the len of the list;
    	int len = 1;
    	ListNode last = head;
    	while(last.next != null) {
    		len++;
    		last = last.next;
    	}
    	
    	n = n % len;
    	ListNode tail = head;
    	int count = len - n - 1;
    	while(count > 0) {
    		tail = tail.next;
    		count--;
    	}
    	
    	last.next = head;
    	head = tail.next;
    	tail.next = null;
    	
    	return head;
    }