NSArray * b = @[@5,@2,@3,@1,@8];
NSMutableArray *a = @[].mutableCopy;
for (int i=0; i<11; i++) {
a[i] = @0;
}
for (NSNumber *num in b) {
int index = [num intValue];
if(a[index]){
a[index] = @([a[index] intValue] + 1);
} else {
a[index] = @0;
}
}
for (int i = 0; i<a.count; i++) {
if([a[i] intValue]>0){
NSLog(@"%d",i);
}
}