#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-9;   const int INF = 1e9;   using ll = long long;   using ull = unsigned long long;   using vi = vector<int>;   using vl = vector<ll>;   using vb = vector<bool>;   using vc = vector<char>;   using vii = vector<vi>;   using vll = vector<vl>;   using pii = pair<int, int>;   using pll = pair<ll, ll>;   using vpii = vector<pii>;   using vpll = vector<pll>;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     vl v(n);     ll sum = 0;     for (int i = (0); i < (n); i++) {       cin >> v[i];       sum += v[i];     }     ll m = *max_element(v.begin(), v.end());     sum -= m;     if (sum > m)       cout <<  0 n ;     else       cout << m - sum + 1 << endl;     return 0;   }   