@SuppressWarnings("unchecked")
	private void permute(int[] num, int[] marks, ArrayList<Integer> list)
    {
    	if (list.size() == num.length)
    		ret.add((ArrayList<Integer>)list.clone());
    	
    	for (int i = 0; i < num.length; i++)
    		if (marks[i] == 1 || i > 0 && num[i] == num[i-1] && marks[i-1] == 0)
    			continue;
    		else
    		{
    			marks[i] = 1;
    			list.add(num[i]);
    			permute(num, marks, list);
    			list.remove(list.size() - 1);
    			marks[i] = 0;
    		}
    	
    }