SPOJ - Count inversions in a small array