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 <iostream>
#include <vector>

int main() {
  int n;
  int t;

  std::cin >> n;

  int w_index = -1;
  int e_index = -1;

  for (int i = 0; i < n; ++i) {
    std::cin >> t;

    if (w_index == -1) {
      w_index = t;
    }

    if (e_index == -1) {
      e_index = t;
    }

    if (t < w_index) {
      w_index = t;
    }

    if (e_index < t) {
      e_index = t;
    }
  }

  t = (e_index - w_index) % 2 == 0 ? ((e_index - w_index) / 2) : ((e_index - w_index) / 2 + 1);
  std::cout << std::max(w_index + t - w_index, e_index - w_index - t) << std::endl;

  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[0]+1)/2 << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> x(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>x[i];
    sum+=x[i];
  }
  sum/=n;
  int ans=100000000;
  for(int i=-500;i<500;i++){
    int tmp=0;
    for(int j=0;j<n;j++){
      tmp=max(tmp,abs((sum+i)-x[j]));
    }
    ans=min(ans,tmp);
  }
  cout<<ans<<'\n';
  return(0);
}

C++: #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
	int n;
    cin >> n;
    vector<int> x(n);
    int mx = -1;
    int mn = 2001;
    rep(i,0,n){
        cin >> x[i];
        if(mx < x[i]){
            mx = x[i];
        }
        if(mn > x[i]){
            mn = x[i];
        }
    }

    if((mx - mn)%2 == 0){
        cout << (mx - mn) / 2 << endl;
        return 0;
    }else{
        cout << (mx - mn) / 2 + 1 << endl;
        return 0;
    }
}

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

int main() {
	long long N;
	long long n = 2001;

	cin >> N;
	vector<long long> x(N);
	rep(i, N) cin >> x[i];
	sort(x.begin(), x.end());
	if(N == 1) {
		cout << 0 << endl;
		return 0;
	}
	rep(i, x[N-1]) {
		long long a = 0;
		rep(j, N) a = max(a, abs(i - x[j]));
		if(a < n) {
			n = a ;

		}
	}
	cout << n << endl;
}

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

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

C++: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 1005

int N;

int main(){

	scanf("%d",&N);

	int tmp;
	int minimum = BIG_NUM,maximum = -BIG_NUM;

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

		scanf("%d",&tmp);

		minimum = min(minimum,tmp);
		maximum = max(maximum,tmp);
	}

	if((maximum-minimum)%2 == 0){

		printf("%d\n",(maximum-minimum)/2);

	}else{

		printf("%d\n",(maximum-minimum)/2+1);
	}

	return 0;
}

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

int main()
{

    int N, minv = 2001, maxv = 0, h;
    std::scanf("%d", &N);
    for (int i = 0; i < N; i ++) {
        std::scanf("%d", &h);
        minv = std::min(minv, h), maxv = std::max(maxv, h);
    }
    ((maxv - minv) % 2 == 0) ? std::printf("%d\n", (maxv-minv)/2) : std::printf("%d\n", (maxv-minv)/2+1);

    return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <vector>
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[0]+1)/2 << endl;
}

C++: #include<iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<math.h>
#include<vector>
#include<algorithm>
#include<map>
#pragma warning(disable: 4996)
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;


int main() {
	
	int N;
	cin >> N;
	vector<int> x(N);
	int num = 1000000, sum = -1;
	rep(i, N) {
		cin >> x[i];
		if (x[i] < num) {
			num = x[i];
		}
		if (x[i] > sum) {
			sum = x[i];
		}
	}

	int d = (num + sum) / 2;
	int ans;
	if (sum - d >= d - num) {
		 ans = sum - d;
	}
	else {  ans = d - num; }

	cout << ans << endl;

	return 0;
}

C++: /*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	vector<int> x(n);
	rep(i, n)scanf("%d", &x[i]);
	int ans = INF, tmp = 0;
	rep(i, 2001) {
		tmp = 0;
		rep(j, n)tmp = max(abs(i - x[j]), tmp);
		ans = min(ans, tmp);
	}
	printf("%d\n", ans);

	Please AC;
}