A statistical problem can occur several times each number, you need to define an array // key codes int VIS [ 10005 ]; Memset (VIS, 0 , the sizeof (VIS)); for ( int I = 0 ; I < n-; I ++ ) { VIS [A [I]] ++ ; } for ( int I = 0 ; I <n-; I ++ ) { IF (VIS [I] == ???????? ) the printf ( " D% \ n- " , I); }