پاسخ پرسش چک کردن اعداد متوالی O(nlogn)
def is_permutation(a): return sorted(a) == list(range(1, max(a) + 1))