Go: package main

import "fmt"

func main() {
	var n, x int
	fmt.Scanln(&n)
	min, max := 2000, 0
	for ; n > 0; n-- {
		fmt.Scan(&x)
		if x < min {
			min = x
		}
		if x > max {
			max = x
		}
	}
	fmt.Println((max - min + 1) / 2)
}

C++: #include <bits/stdc++.h>

typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
#define all(a) a.begin(),a.end()
#define MOD 1000000007
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}
ll lcm(ll n, ll m) {return m / gcd(n, m) * n;}

int main(void) {
	ll n;
	cin >> n;
	int tmp;
	int Max = -100;
	int Min = 10000;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (tmp > Max) Max = tmp;
		if (tmp < Min) Min = tmp;
	}
	if ((Max - Min) % 2 == 0)	cout << (Max - Min) / 2 << endl;
	else cout << (Max - Min) / 2 + 1 << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int min=10000;
  int max=0;
  int n,x,home;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x;
    if(min>=x) min=x;
    if(max<=x) max=x;
  }
    home=(max+min)/2;
    cout<<max-home<<endl;
}

C++: // #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    vector<int> x(N);
    for(int i=0; i<N; i++) cin >> x[i];

    int ans = INF;
    for(int i=0; i<2010; i++) {
        int cand = 0;
        for(int j=0; j<N; j++) {
            int d = abs(i - x[j]);
            chmax(cand, d);
        }
        chmin(ans, cand);
    }
    cout << ans << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
const long double PI = acos(-1.0);
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define SORT(v) sort(ALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;

#define HOGE COUT("HOGE")

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
int main() {
    IN(int, n);
    VIN(int, a, n);
    SORT(a);
    int aja = (a[n-1]-a[0]+1)/2;
    COUT(aja);
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
 
    int n;
    cin>>n;
    int a[n];
    bool used[2222]={};
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int ans = 1e9;
    for(int i=0;i<=2000;i++){
        ans = min(ans,max(i-a[0],a[n-1]-i));
    }
    cout << ans<< endl;
    
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  cout << (x[n - 1] - x[0] + 1) / 2 << endl;
  return 0;
}

C++: #include <algorithm>
#include <climits>
#include <iostream>
using namespace std;

int main() {
	int N, x, a = 0, b = INT_MAX;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> x;
		a = max(a, x);
		b = min(b, x);
	}
	cout << (1 + a - b) / 2 << endl;
}

C++: #include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n ; cin >> n ;
	ll mn = 1000000000,mx = 0 ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		if(a>mx) mx = a ;
		if(a<mn) mn = a ;
	}
	ll d = mx-mn ;
	if(d&1) cout << d/2+1 << endl ;
	else cout << d/2 << endl ;
}

C++: #include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int n, t, minv=2001, maxv=-1, diff;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &t);
        minv = min(minv, t);
        maxv = max(maxv, t);
    }
    diff = maxv - minv;
    diff = (diff % 2 == 0) ? diff/2 : diff/2+1;
    printf("%d\n", diff);
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> x(N);
  for (int i = 0; i < N; i++){
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  cout << (x.back() - x.front() + 1) / 2 << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  int now=(v[0]+v[n-1]+1)/2;
  cout << now-v[0] << endl;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> A(n);
    for(int i = 0; n > i; i++){
        cin>>A[i];
    }
    sort(A.begin(),A.end());
    if(A[n-1]==A[0])cout << 0 << endl;
    else cout << (A[n-1]-A[0]-1)/2+1 << endl;
}

C++: #include <iostream>
using namespace std;

int main(void){
  int n;
  int mn,mx;
  cin >> n;
  mx = 0; mn = 2000;
  for (int i=0; i<n; i++){
    int t; cin >> t;
    if (t>mx) mx = t;
    if (t<mn) mn = t;
  }
  cout << (mx-mn+1)/2 << endl;
  return 0;
}