#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "math.h" #include "utility" #include "map" using namespace std; const long long int MOD = 1000000007; typedef pair P; int N; long long int num[2000]; long long int dis[2000]; bool flag[2000]; bool fflag[2001]; long long int ff; long long int ans=LLONG_MAX; long long int box; long long int bag; long long int current; priority_queue, greater >Q; long long int node; int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> num[i]; } for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { dis[j] = LLONG_MAX; flag[j] = true; fflag[j] = true; } fflag[2000] = true; dis[i] = num[i]; Q.push((dis[i] * 10000 + i)*10000+2000); box = 0; while (!Q.empty()&&box