#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> arr(n); for(int i = 0; i < n; i++) cin >> arr[i]; vector<int> mx(n,0),mn(n,0); mn[0] = mx[0] = arr[0]; int ret = arr[0]; for(int i = 1; i < n; i++) { if(arr[i] == 0){ mx[i] = 0; mn[i] = 0; }else if(arr[i] > 0){ mx[i] = max(arr[i]*mx[i-1],arr[i]); mn[i] = min(arr[i],arr[i]*mn[i-1]); }else { mx[i] = max(arr[i] * mn[i-1],arr[i]); mn[i] = min(arr[i],mx[i-1]*arr[i]); } if(mx[i] > ret) ret = mx[i]; } cout << ret << endl; return 0; } // 64 位输出请用 printf("%lld")