void merge_sort(int* p, int l, int r) {
if (l >= r) return;
int mid = l + r >> 1;
merge_sort(p, l, mid);
merge_sort(p, mid + 1, r);
int i = l, j = mid + 1, k = 0;
while (i <= mid && j <= r) {
if (p[i] <= p[j]) temp[k++] = p[i++];
else temp[k++] = p[j++];
}
while (i <= mid) temp[k++] = p[i++];
while (j <= r) temp[k++] = p[j++];
for (int i = l, k = 0; i <= r; i++, k++) p[i] = temp[k];
}