Question: I have a NSArray with possibly hundreds of elements. I want to remove every element but the 20 first ones. Ideas?

Answer: 
If your array is an NSArray, then you can't remove objects since it's immutable. You'll need to do something like Neo's answer. If your array is an NSMutableArray, you can use the following line to get the first 20 items:

```
[myArray removeObjectsInRange:NSMakeRange(20, myArray.count - 20)];

```
Suppose your NSArray is yourArray, do this

```
NSMutableArray *temp=[[NSMutableArray alloc]initWithArray:yourArray];
for(int i=0; i<20;i++){
    [temp addObject:[yourArray objectAtIndex:i]];
}
yourArray=[NSArray arrayWithArray:temp];

```