void selectionSort(A, N){                                                                                        
  int i, minj, j, t, c = 0;                                                                                 
  for(i = 0; i < N; i++){                                                                                   
    minj = i;                                                                                               
    for(j = i; j < N; j++){                                                                                 
      if(A[j] < A[minj]){                                                                                   
        minj = j;                                                                                           
      }                                                                                                     
    }                                                                                                       
    if(i != minj){                                                                                          
      t = A[i];                                                                                             
      A[i] = A[minj];                                                                                       
      A[minj] = t;                                                                                          
      c++;                                                                                                  
    }                                                                                                       
  }                                                                                                         
  for(i = 0; i < N; i++){                                                                                   
    printf("%d ",A[i]);                                                                                     
  }                                                                                                         
  printf("\n%d\n", c);                                                                                      
}