Your task is to write a function that does just what the title suggests (so, fair warning, be aware that you are not getting out of it just throwing a lame bas sorting method there) with an array/list/vector of integers and the expected number `n` of smallest elements to return.
Also:
* the number of elements to be returned cannot be higher than the array/list/vector length;
* elements can be duplicated;
* in case of duplicates, just return them according to the original order (see third example for more clarity).
Same examples and more in the test cases:
```python
first_n_smallest([1,2,3,4,5],3) == [1,2,3]
first_n_smallest([5,4,3,2,1],3) == [3,2,1]
first_n_smallest([1,2,3,4,1],3) == [1,2,1]
first_n_smallest([1,2,3,-4,0],3) == [1,-4,0]
first_n_smallest([1,2,3,4,5],0) == []
```
[Performance version by FArekkusu](https://www.codewars.com/kata/5aeed69804a92621a7000077) also available.
def first_n_smallest(arr, n):
    smallest = []
    replacement = max(arr) + 1
    while n and arr:
        num = min(arr)
        idx = arr.index(num)
        arr[idx] = replacement
        smallest.append((num, idx))
        n -= 1
    sort = sorted(smallest, key=lambda pair: pair[1])
    return [p[0] for p in sort]
def first_n_smallest(arr, n):
    smallest = []
    replacement = max(arr) + 1
    while n and arr:
        num = min(arr)
        idx = arr.index(num)
        arr[idx] = replacement
        smallest.append((num, idx))
        n -= 1
    sort = sorted(smallest, key=lambda pair: pair[1])
    return [p[0] for p in sort]