#include <iostream> using namespace std; long long max(long long a, long long b) { return a > b ? a : b; } int main() { int n = 0; long long arr[200000] = {0}; long long app[200000] = {0}; cin >> n; for (int i = 0; i < n && cin >> arr[i]; i++); app[0] = arr[0]; app[1] = max(arr[1], arr[0]); for (int i = 2; i < n; i++) { app[i] = max(app[i-2] + arr[i], app[i-1]); } cout << app[n-1]; return 0; } // 64 位输出请用 printf("%lld")