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"
#pragma GCC optimize("Ofast")

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, b, e) for (intmax_t i = (b), i##_limit = (e); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class Container>
struct reverse_t {
    Container &c;
    reverse_t(Container &c) : c(c) {}
    auto begin() { return c.rbegin(); }
    auto end() { return c.rend(); }
};

template <class Container>
auto reversed(Container &c) {
    return reverse_t<Container>(c);
}

template <class T>
inline bool chmax(T &a, const T &b) noexcept {
    return b > a && (a = b, true);
}

template <class T>
inline bool chmin(T &a, const T &b) noexcept {
    return b < a && (a = b, true);
}

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    var(size_t, N);

    vector<intmax_t> x(N);
    input(x);

    intmax_t minv = INF;
    reps(c, 0, 2000) {
        intmax_t maxv = 0;
        for (const auto xi: x) chmax(maxv, diff(c, xi));
        chmin(minv, maxv);
    }

    output(minv);

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    
    int N , Max = 0 , min = 2000 ;
    cin >> N ;
    
    int x[N] ;
    
    for(int i = 1 ; i <= N ; i++){
        cin >> x[i] ;
    }
    
    for(int j = 1 ; j <= N ; j++){
        if(Max <= x[j]){
            Max = x[j] ;
        }
        if(min >= x[j]){
            min = x[j] ;
        }
    }
    
    int S ;
    S = (Max - min + 1) / 2 ;
    
    cout << S << endl ;
}

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

int main() {
  int N;
  cin >> N;
  int x[1100];
  for (int i = 0; i < N; i++) cin >> x[i];

  int ans = 1000000;
  for (int i = 0; i <= 2000; i++) {
    int time = 0;
    for (int j = 0; j < N; j++) {
      time = max(time, abs(i - x[j]));
    }
    ans = min(ans, time);
  }

  cout << ans << endl;
  
  return 0;
}

C++: // 2020/07/13 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int N;
	cin >> N;

	int x_max = -1;			// 最も東の地点
	int x_min = 2001;		// 最も西の地点

	for(int i=0; i<N; i++){
		int x;
		cin >> x;

		x_max = max(x, x_max);
		x_min = min(x, x_min);
	}

	cout << (x_max-x_min+1)/2 << endl;	// .5を切り上げるために

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int n;
    cin >>n;
    int a[n];
    for(int i=0;i<=n-1;i++){
        cin >>a[i];
    }
    int min=a[0],max=a[0];
    for(int j=0;j<=n-1;j++){
        if(min>=a[j]) min=a[j];
    }
    for(int j=0;j<=n-1;j++){
           if(max<=a[j]) max=a[j];
       }
    int ave=(max-min+1)/2;
    
    cout<<ave<<endl;
    
}

C++: #include"bits/stdc++.h"
using namespace std;

int N;
int x[1000];
int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> x[i];
	int m = INT_MAX;
	for(int i=0; i<=2000; i++){
		int tmp = 0;
		for(int j=0; j<N; j++){
			tmp = max(tmp, abs(x[j]-i));
		}
		m = min(m, tmp);
	}
	cout << m << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define MOD 1000000007
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(void){
    int N,ans;cin>>N;
    VI x(N,-1);
    REP(i,N)cin>>x[i];
    sort(All(x));
    ans=x[N-1]-x[0];
    if(ans%2!=0){
        ans=int(ans/2);
        ans++;
    }else{
        ans=int(ans/2);
    }
    cout<<ans<<endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	V a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int ans = upper;
	rep(i, 2001) {
		int tmp = 0;
		rep(j, n) {
			chmax(tmp, abs(i - a[j]));
		}
		chmin(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}