Elements of Array should have a difference greater than 1

Hi All,
I am trying to constraint unpacked array of size 5 such that no elements have a difference of 1
Eg: array1 = '{ 0 , 5 , 1 , 10 , 7 } would be illegal as index 0 and 2 have elements with a difference of 1
I tried using array reduction or() ::

 class C;
    
    rand bit[3:0] val[];
    
    constraint SIZE { val.size() == 5 ; }
    
    constraint VAL { 
                       foreach(val[i])
                     {
                       val.or() with ( (item.index != i ) ? (  ( item > val[i] ) ? int'( item - val[i] ) : int'( val[i] - item )  ) : 0 ) > 1 ;
                     }  
                   }
                         
    constraint UNIQ { unique { val } ; }                         
  endclass  
  
  C c1 = new();
      
  initial begin
    repeat(10) begin 
      if( c1.randomize() )
        $display("Success with %0p",c1);  
    end  
  end  

However I do see indexes with elements having a difference of 1, any suggestions where I am falling short ?

I think you want a nested foreach

constraint SIZE { val.size() == 5 ; }

constraint VAL { foreach(val[i]) foreach (val[j])
                    i !=j -> (val[i] > val[j] ? val[i] - val[j] : val[j] - val[i])  > 1
                   }

You would no longer need the UNIQ constraint.