#define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #include using namespace std; using ll = long long; const int N = 1e6 + 60; int a[N]; void die(int x) { printf("%d", x); exit(0); } int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", a + i); multiset S(a, a + n); long long cur = 0; while (!S.empty()) { int t = ceil(sqrt(*S.begin())); cur = max(cur, *S.begin()); S.erase(S.begin()); cur += t; auto ite = S.upper_bound(cur); if (ite != S.begin()) ite--; if (ite == S.end()) die(1); if (*ite != *S.begin()) die(0); } die(1); return 0; }