import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
{
java.
util.
Scanner in
= new java.
util.
Scanner(System.
in); int n = in.nextInt();
int []x = new int [n];
int counter = 0; // количество перемещений
for (int i = 0; i < n; i++){
x[i] = in.nextInt();
}
int first = x[0]; // первый по порядку элемент
for (int i = 0; i < n - 1; i++) {
int min = i; // индекс минимального элемента
for (int j = i + 1; j < n; j++) {
if (x[j] < x[min]) min = j;
}
if((x[i] == first || x[min] == first) && x[i] != x[min]) counter ++;
int t = x[i];
x[i] = x[min];
x[min] = t;
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CiAKY2xhc3MgTWFpbgp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlqYXZhLnV0aWwuU2Nhbm5lciBpbiA9IG5ldyBqYXZhLnV0aWwuU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCWludCBuID0gaW4ubmV4dEludCgpOwoJCWludCBbXXggPSBuZXcgaW50IFtuXTsKCSAgICBpbnQgY291bnRlciA9IDA7IC8vINC60L7Qu9C40YfQtdGB0YLQstC+INC/0LXRgNC10LzQtdGJ0LXQvdC40LkKCSAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKyl7CgkgICAgICAgIHhbaV0gPSBpbi5uZXh0SW50KCk7CgkgICAgfQoJICAgIGludCBmaXJzdCA9IHhbMF07IC8vINC/0LXRgNCy0YvQuSDQv9C+INC/0L7RgNGP0LTQutGDINGN0LvQtdC80LXQvdGCCgkgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuIC0gMTsgaSsrKSB7CgkgICAgICAgIGludCBtaW4gPSBpOyAvLyDQuNC90LTQtdC60YEg0LzQuNC90LjQvNCw0LvRjNC90L7Qs9C+INGN0LvQtdC80LXQvdGC0LAKCSAgICAgICAgZm9yIChp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