jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXSIZE=30000020;
int bufpos;
char buf[MAXSIZE];
#define NEG 0
void init(){
	#ifdef LOCAL
		freopen("A.txt","r",stdin);
	#endif
	buf[fread(buf,1,MAXSIZE,stdin)]='\0';
	bufpos=0;
}
#if NEG
int readint(){
	bool isneg;
	int val=0;
	for(;!isdigit(buf[bufpos]) && buf[bufpos]!='-';bufpos++);
	bufpos+=(isneg=buf[bufpos]=='-');
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return isneg?-val:val;
}
#else
int readint(){
	int val=0;
	for(;!isdigit(buf[bufpos]);bufpos++);
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return val;
}
#endif
char readchar(){
	for(;isspace(buf[bufpos]);bufpos++);
	return buf[bufpos++];
}
int readstr(char* s){
	int cur=0;
	for(;isspace(buf[bufpos]);bufpos++);
	for(;!isspace(buf[bufpos]);bufpos++)
		s[cur++]=buf[bufpos];
	s[cur]='\0';
	return cur;
}
int a[100002];
int main(){
	init();
	int n=readint();
	while(n--)
		a[readint()]++;
	int ans=0;
	for(int i=0;i<=100000;i++){
		int now=a[i];
		if (i)
			now+=a[i-1];
		now+=a[i+1];
		ans=max(ans,now);
	}
	printf("%d\n",ans);
}
//  [cpp]
#pragma GCC optimize("O3")
#include <iostream>

template<typename T> inline void chmax(T &a, T b){if (a < b) a = b; return;}

template<typename T> inline void fastin(T &num) {
  T c;
  num = 0;
  c = getchar_unlocked();
  for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (num << 3) + (num << 1) + c - 48;
}

template<typename T> void fastout(T &n) {
  T N = n, rev, count = 0;
  rev = N;
  if (N == 0) { 
    putchar_unlocked('0');
    putchar_unlocked('\n');
    return;
  }
  while ((rev % 10) == 0) { 
    ++count; rev /= 10;
  }
  rev = 0;
  while (N != 0) { 
    rev = (rev << 3) + (rev << 1) + N % 10;
    N /= 10;
  }
  while (rev != 0) { 
    putchar(rev % 10 + '0');
    rev /= 10;
  }
  while (count--) putchar_unlocked('0');
  putchar_unlocked('\n');
}

int main(){
  int n; fastin(n);
  int count[100005] = {};
  for (int i = 0; i < n; ++i) {
    int a; fastin(a);
    ++count[a];
  }

  int ans = 1;
  for (int i = 0; i < n; ++i) {
    chmax(ans, count[i] + count[i + 1] + count[i + 2]);
  }
  
  fastout(ans);

  return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <array>

using namespace std;

//デバッグ時はTESTを定義する。本番時はこの行をコメントアウトする
//#define TEST //*******************************************************************************************************************************************

//そうすることで、以下に定義する、デバッグ時にのみ標準出力する、doutコマンドが実現できる。本番時はダミーストリームに出力
#ifdef TEST
    #define dout cout
#else
    stringstream dummy; //デバッグ時のdoutコマンドのダミー出力先
    #define dout dummy.str(""); dummy.clear(stringstream::goodbit); dummy //dummyを毎回リセットしておかないとメモリ溢れちゃう。
    //どうせ表示しないからgoodbitしなくていいけど、表示する場合はこれしておかないとバグるらしいので、勉強のために。詳しくは http://d.hatena.ne.jp/linden/20060427/p1
#endif


////////////////////////////////////////
//AtCoder Beginner Contest 072
//C - Together
//
//±1範囲内に収まるa[]の数の最大値を求めよ
//TLEで手詰まり中
////////////////////////////////////////

#define value first
#define cnt second


int main(void) {
    int numOfData;
    cin >> numOfData;

    //input data
    int a[numOfData];
    for(int i=0; i<numOfData; i++) {
        cin >> a[i];
    }

    //a[]のvalueごとに数をカウント
    vector< pair<int, int> > list; //list[].first = value, .second = 当該valueの出現回数
    
    for(int i=0; i<numOfData; i++) {
        
        auto v = list.begin();
        for(; v!=list.end(); v++) {
            if(v->value == a[i]) { //(*v).value OK, *v.value NG
                v->cnt++;
                break;
            }
        }
        
        if( v==list.end() ) { //list中に当該valueが見つからなかった場合
//            pair<int, int> new_pair = {a[i], 1};
//            list.push_back(new_pair);
            list.push_back( make_pair(a[i], 1) ); //最後尾に新しいペアを挿入
        }
        
    } //end of i-loop

    //display list
    dout << "list\n";
    for(auto v : list) {
        dout << v.value << " " << v.cnt << endl;
    }
    dout << endl;

    //sort list
    sort(list.begin(), list.end()); //O(N*logN)
    
    //display list
    dout << "list\n";
    for(auto v : list) {
        dout << v.value << " " << v.cnt << endl;
    }
    dout << endl;
    
    //calc. max
    int numOfX;
    int numOfX_max = 0;
    
    dout << "calc. numOfX\n";
    
    auto v = list.begin();
    int X = v->value;
    numOfX = v->cnt + ((v+1)->value == X+1 ? (v+1)->cnt : 0); //listの先頭なので前は見ず、後ろだけ
    dout << v->value << " " << numOfX << endl;
    
    numOfX_max = numOfX; //最初の値をMaxに暫定設置
    
    for(++v; v!=list.end(); v++) {
        X = v->value;
        numOfX = ((v-1)->value == X-1 ? (v-1)->cnt : 0 ) + v->cnt + ((v+1)->value == X+1 ? (v+1)->cnt : 0); //前後を見てそれぞれX-1, X+1に等しいときだけcntをカウント
        if( numOfX_max < numOfX )
            numOfX_max = numOfX;
    
        dout << v->value << " " << numOfX << endl;
    }

    dout << "numOfX_max = ";
    cout << numOfX_max << endl;
    
    return 0;
}
//  [cpp]
#include <iostream>
#include<algorithm>
using namespace std;

int main() {
	int n;
	cin>>n;
	int arr[n];
	for (int i=0; i<n; i++){
		cin>>arr[i];
	}
	sort(arr, arr+n);
	int z = 0;
	for (int i=0; i<n; i++){
		int cnt = 0;
		for (int j=0; j<n; j++){
			if (arr[j]==arr[i]) cnt++;
			else if (arr[j] ==arr[i]-1) cnt++;
			else if (arr[j]==arr[i]+1) cnt++;
		}
		//cout << cnt << endl;
		z = max(cnt, z);
	}
	cout << z;
	

}
//  [cpp]
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}
bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};

int main(){
    ll N; cin >> N;
    const ll al = 1e6 + 10;
    map<ll, ll> m;
    REP(i, al) m[i] = 0;
    REP(i, N){
        ll a; cin >> a; m[a]++;
    }
    
    ll ret = 0;
    REP(i, al - 2){
        ll tmp = m[i] + m[i+1] + m[i+2];
        ret = max(ret, tmp);
    }
    cout << ret << endstr;
    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define BUF_SIZE 1000000

int main(void) {
  char line[BUF_SIZE];
  FILE *fp = stdin;
  int num;
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  sscanf(line, "%d", &num);

  if(!fgets(line, BUF_SIZE, fp)) return 0;
  char *tmpbuf = line;
  int i;
  int hist[100001] = {0};
  int ma = 0;
  int mi = 100001;
  for(i = 0; i < num; i++) {
    char *tmp = strtok(tmpbuf, " ");
    int n = strtol(tmp, NULL, 10);
    hist[n]++;
    if(n > ma) ma=n;
    if(n < mi) mi=n;
    tmpbuf = NULL;
  }
  int max = 0;
  for(i = mi; i <= ma; i++) {
    int change = hist[i];
    if(i-1>=0) change += hist[i-1];
    if(i+1<=100000) change += hist[i+1];
    if(change > max) max = change;
  }

  printf("%d\n", max);
  return 0;
}
//  [c]
N,S,a;
v[1<<17];
main()
{
  scanf("%d",&N);
  for(;~scanf("%d",&a);)v[a]++;
  for(a=1;a<1e5;a++)
  {
    S=fmax(S,v[a-1]+v[a]+v[a+1]);
  }
  printf("%d\n",S);
}
//  [c]
int main()
{
    int n,i,a;
    int amax=0,bmax=0;
    int b[100001]={0};
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++)
    {
        scanf("%d",&a);
        if(amax<a)
        {
            amax=a;
        }
        
        b[a]+=1;
        
        if(a!=0)
        {
            b[a-1]+=1;
        }
        if(a<100000)
        {
            b[a+1]+=1;
        }
    }
    
    for(i=0; i < amax+1; i++)
    {
        if(bmax<b[i])
        {
            bmax=b[i];
        }
    }
    
    printf("%d\n",bmax);
    
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int *Marge(int N,int *B){
	if (N==1){
		int *C=malloc(sizeof(int));
		C=B;
		return C;
	}

	if (N>1){
		int N1=N/2;
		int N2=N-N1;
		int *B1=malloc(N1*sizeof(int));
		int *B2=malloc(N2*sizeof(int));
		int i;
		for (i=0;i<N1;i++){
			B1[i]=B[i];
		}
		for (i=N1;i<N;i++){
			B2[i-N1]=B[i];
		}
		int *BB1=Marge(N1,B1);
		int *BB2=Marge(N2,B2);
		int *C=malloc(N*sizeof(int));
		int k=0;
		int l=0;
		int m=0;
		while(1){
			if (k>=N1){
				for (m;m<N;m++){
					C[m]=BB2[l];
					l++;
				}
				break;
			}
			if (l>=N2){
				for (m;m<N;m++){
					C[m]=BB1[k];
					k++;
				}
				break;
			}
			else{
				if (BB1[k]<BB2[l]){
					C[m]=BB1[k];
					m++;
					k++;
				}
				if (BB1[k]>=BB2[l]){
					C[m]=BB2[l];
					m++;
					l++;
				}
			}
		}
		return C;
	}
}

int main(){
	int N;
	int i,j;
	scanf("%d",&N);
	int *A=(int*)malloc(N*sizeof(int));
	int new_N=3*N;
	int *B=(int*)malloc(new_N*sizeof(int));
	int *C=(int*)malloc(new_N*sizeof(int));
	for (i=0;i<N;i++){
		scanf("%d",&A[i]);
		B[3*i]=A[i]-1;
		B[3*i+1]=A[i];
		B[3*i+2]=A[i]+1;
	}
	C=Marge(new_N,B);
	int last_ans=0;
	i=0;
	while(i<new_N){
		int ans=0;
		int num=C[i];
		while(i<new_N&&C[i]==num){
			ans++;
			i++;
		}
		if (last_ans<ans){
			last_ans=ans;
		}
	}
	printf("%d\n",last_ans);
	return 0;
}
//  [c]
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define MOD 1000000007
typedef long long ll;

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))

int compareInt(const void* a, const void* b)
{
    int aNum = *(int*)a;
    int bNum = *(int*)b;

    return aNum - bNum;
}

/*
    最頻値を求める

    引数
        array: 対象の配列
        size:  array の要素数
    戻り値
        最頻値
*/
int get_mode(const int* array, size_t size)
{
    assert(array != NULL);
    assert(size > 0);

    // [!] 配列が昇順にソートされていることを前提にしている

    int mode;              // これまでに調べた中での最頻値
    int count_max = 0;     // これまでに調べた登場回数の中で最大のもの

    for (size_t i = 0; i < size; ) {

        int value = array[i];
        int count = 1;
    
        // ソートされているのだから、
        // 同じ値があるとすれば、後続に連続して並んでいるはず。
        // その回数をカウントする。
        for (i = i + 1; i < size; ++i) {
            if (value == array[i]) {
                ++count;
            }
            else {
                // 違う値が登場したら終わり
                break;
            }
        };

        // これまでの最大の登場回数よりも多かったら、更新する
        if (count_max < count) {
            count_max = count;
            mode = value;
        }
    }

    return count_max;
}


int main(){
	int n;
	scanf("%d", &n);
	int a[n * 3];
	rep(i, n) scanf("%d", &a[i]);
	rep(i, n) a[n + i] = a[i] + 1;
	rep(i, n) a[n * 2 + i] = a[i] - 1;
	
	qsort(a, SIZE_OF_ARRAY(a), sizeof(int), compareInt);
	int t = get_mode(a, SIZE_OF_ARRAY(a));
	
	printf("%d", t);
	
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int c(const void * d, const void * e)
{
   return ( *(int*)d - *(int*)e );
}
int main()
{
    int i, j, N, max=0, count;
    scanf("%d", &N);
    int a[3*N];
    for(i=0;i<(N*3);i+=3){
        scanf("%d", a+i);
        a[i+1]=a[i]-1;
        a[i+2]=a[i]+1;
    }
    if(N==1)max=1;
    else{

        int current=a[0]+1;
        qsort(a, N*3, sizeof(int), c);
        for(j=0;j<(N*3);j++){
            if(current!=a[j]){
                current=a[j];
                count=1;
            }
            else{
                count+=1;
                if(count>max)max=count;
            }
        }
    }
    if(max==0)max=1;
    printf("%d", max);
    return 0;
}
//  [javascript]
function Main(input) {
    input = input.split("\n")
    const n = parseInt(input[0])
    var A = input[1].split(" ")
    
    var tmp = {}
    for (var i=0;i<100000;i++){
        tmp[i]=0
    }

    for (var i=0;i<n;i++){
        var a = parseInt(A[i])
        tmp[a-1]++
        tmp[a]++
        tmp[a+1]++
    }

    var ans = 0
    for (var i=0;i<100000;i++){
        ans = Math.max(ans,tmp[i])
    }
    
    console.log(ans)

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0]);
  tmp = input[1].split(" ");
  a = new Array(Math.pow(10,5)+1).fill(0);
  for(i=0;i<n;i++){
    var t = parseInt(tmp[i]);
    a[t-1]++;
    a[t]++;
    a[t+1]++;
  }
  var ans = Math.max.apply(null,a);
  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {

    const lines = input.split('\n')
    const N = lines[0] - 0
    const a = lines[1].split(' ').map(Number)

    a.sort((a, b) => a - b)

    const dp = Array(a[N - 1] + 2).fill(0)
    for (let i = 0; i < N; i++) {
        dp[a[i]]++
    }

    const sum = []
    sum[0] = dp[0] + dp[1]
    for (let i = 1; i < dp.length - 1; i++) {
        sum[i] = dp[i - 1] + dp[i] + dp[i + 1]
    }

    console.log(Math.max(...sum))

})(input)
//  [javascript]
// concatなしバージョン

"use strict";
    
const main = arg => {
  let NumAmount = arg.split("\n")[0]*1;
  let Nums = arg.split("\n")[1].split(" ").map(n => n*1);  
  let ans = 0;
  let PlusNums = Nums.map(x=> x + 1);
  let MinusNums = Nums.map(x=> x - 1);
let AllArr = [...Nums,...PlusNums,...MinusNums];
  //console.log(AllArr);
  let AllArrObj = {};
  let AllArrValues = [];
  for(let i = 0; i < AllArr.length; i++){
  if( isNaN(AllArrObj[AllArr[i]]) ){
	AllArrObj[AllArr[i]] = 0;
  }
  AllArrObj[AllArr[i]] += 1;
  }
  //console.log(AllArrObj);
  // valueのみ抽出して最大値を求める
  Object.keys(AllArrObj).forEach( function(value) {
      AllArrValues.push(this[value]);
  }, AllArrObj)
  console.log(Math.max(...AllArrValues)); 
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict"
function Main(input) {
  input = input.trim().split('\n');
  const N = Number(input[0].trim());
  const A = input[1].trim().split(' ').map(Number);

  if(N === 1) {
    console.log('1');
    return;
  }

  let ret = {};
  for(let n of A){
    ret[n - 1] = ret[n - 1] ? ret[n - 1] + 1 : 1;
    ret[n] = ret[n] ? ret[n] + 1 : 1;
    ret[n + 1] = ret[n + 1] ? ret[n + 1] + 1 : 1;
  }
  
  let ans = 0;
  Object.keys(ret).map((k) => {
    if(ret[k] > ans) ans = ret[k];
  })

  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func r() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := r()

	vs := make([]int, 100001)
	max := -int(^uint(0)>>1) - 1
	for a, i := 0, 0; i < n; i++ {
		a = r()

		vs[a]++
		switch a {
		case 0:
			vs[a+1]++
		case 100000:
			vs[a-1]++
		default:
			vs[a-1]++
			vs[a+1]++
		}

		if a != 0 && vs[a-1] > max {
			max = vs[a-1]
		}
		if a != 100000 && vs[a+1] > max {
			max = vs[a+1]
		}
		if vs[a] > max {
			max = vs[a]
		}
	}

	fmt.Println(max)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	_ = nextInt()
	a := nextIntArray()
	pos := make([]int, 100000+2)
	for _, v := range a {
		pos[v]++
		pos[v+1]++
		pos[v+2]++
	}
	m := 1
	for _, v := range pos {
		if v > m {
			m = v
		}
	}
	fmt.Println(m)
}

const size = 1000000

var reader = bufio.NewReaderSize(os.Stdin, size)

func nextLine() string {
	var line, buffer []byte
	isPrefix := true
	var err error
	for isPrefix {
		line, isPrefix, err = reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
	}
	return string(buffer)
}
func nextStringArray() []string {
	return strings.Split(nextLine(), " ")
}
func nextInt() int {
	n, _ := strconv.Atoi(nextLine())
	return n
}
func nextIntArray() []int {
	s := strings.Split(nextLine(), " ")
	n := len(s)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}

func min(i, j int) int {
	if i > j {
		return j
	}
	return i
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	counter := make(map[int]int,n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)

		counter[a]++
		counter[a-1]++
		counter[a+1]++
	}

	max := 0
	for _, v := range counter {
		if max < v {
			max = v
		}
	}
	fmt.Println(max)
}
//  [go]
package main

import "fmt"

func nextInt() int {
	var x int
	fmt.Scan(&x)
	return x
}

func main() {
	n := nextInt()

	dic := map[int]int{}
	for range make([]struct{}, n) {
		a := nextInt()
		for i := range make([]struct{}, 3) {
			dic[a+i-1]++
		}
	}
	ans := 0
	for _, cnt := range dic {
		if cnt > ans {
			ans = cnt
		}
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		m[a]++
	}

	ans := 0
	for k := range m {
		t := m[k-1] + m[k] + m[k+1]
		if ans < t {
			ans = t
		}
	}

	fmt.Println(ans)
}
//  [ruby]
x = [0] * 100002
readline
readline.split.each do |s|
    a = s.to_i + 1
    x[a-1] += 1; x[a] += 1; x[a+1] += 1
end
puts x.max
//  [ruby]
N = gets.to_i
A = gets.split.map(&:to_i)

B = Array.new(100001, 0)
A.each do |a|
  B[a] += 1
end

ans = 0
(0...100000).each do |i|
  x = B[i - 1] + B[i] + B[i + 1]
  ans = x if x > ans
end
puts ans
//  [ruby]
n = gets.to_i
as = gets.split.map(&:to_i)

max = 10 ** 5
count = Array.new(max + 2, 0)

as.each do |a|
  count[a - 1] += 1
  count[a] += 1
  count[a + 1] += 1
end

puts count.max
//  [ruby]
n = gets.to_i
as = gets.split.map(&:to_i)
bcs = as.map { |a| [a + 1, a - 1] }.flatten

count = [*as, *bcs].each_with_object(Hash.new(0)) do |n, h|
  h[n] += 1
end.sort_by { |_, v| [-v] }

puts count[0][1]
//  [ruby]
N = gets.to_i
ary = gets.split.map(&:to_i)
hash = {}
ary.each do |n|
    hash[n] = hash[n].to_i + 1
end
l = hash.sort
max_vals = {}
l.each_with_index do |a, i|
    pre = i==0 ? 0 : (l[i-1][0]-l[i][0]).abs == 1 ? l[i-1][1] : 0
    post = i==l.size-1 ? 0 : (l[i+1][0]-l[i][0]).abs == 1 ? l[i+1][1] : 0
    max_vals[l[i][0]] = pre + l[i][1] + post
end
puts max_vals.max{|a, b| a[1]<=>b[1]}[1]
//  [ruby]
puts ([0,0]+STDIN.read.lines.drop(1).first.split.map(&:to_i).group_by{ |e| e }.sort.map{ |e| [e[0], e[1].length]}+[0,0]).each_cons(3).map{ |a, b, c| (a[0]==b[0]-1 ? a[1] : 0)+b[1]+(b[0]+1==c[0] ? c[1] : 0) }.max
//  [rust]
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let n : usize = get_one();
    let v : Vec<usize> = get_vec();
    let mut ans = 0;
    let mut w = vec!(0;100005);
    for x in v {
        w[x] += 1;
    }
    for i in 1..w.len()-1 {
        let tmp = w[i-1] + w[i] + w[i+1];
        ans = std::cmp::max(tmp, ans);
    }
    println!("{}", ans);
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        aa: [usize;n]
    }
    let mut v = vec![0;100000];
    for a in aa {
        v[a] += 1;
    }
    let mut max = 0;
    for i in 1..v.len()-1 {
        max = std::cmp::max(max, v[i-1] + v[i] + v[i+1]);
    }
    println!("{}", max);
}
//  [rust]
use std::io::{self};
use std::collections::HashMap;

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).unwrap();
    buffer.clear();
    io::stdin().read_line(&mut buffer).unwrap();
    let mut xs: Vec<i32> = buffer
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    
    xs.sort();
    let mut counter = HashMap::new();
    loop {
        let (key, c) = count_and_truncate(&mut xs);
        counter.insert(key, c);
        if xs.is_empty() {break;}
    }
    let m = counter.keys().map(
        |key| {
            get_default(&counter, *key-1)
            + get_default(&counter, *key)
            + get_default(&counter, *key+1)
        }).max().unwrap();
    println!("{}", m);
}


fn count_and_truncate(xs: &mut Vec<i32>) -> (i32, i32) {
    let mut cnt = 0;
    let key = &xs[0].clone();
    for x in xs.iter() {
        if x != key {
            break;
        }
        cnt += 1;
    }
    xs.drain(..cnt as usize);
    // println!("{:?}", xs);
    (*key, cnt)
}

fn get_default(hashmap: &HashMap<i32, i32>, key: i32) -> i32 {
    match hashmap.get(&key) {
        None => 0,
        Some(x) => *x,
    }
}
//  [rust]
use std::io::{self, Read};
use std::collections::HashMap;

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).unwrap();
    buffer.clear();
    io::stdin().read_line(&mut buffer).unwrap();
    let mut xs: Vec<i32> = buffer
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    
    xs.sort();
    let mut counter = HashMap::new();
    loop {
        let (key, c) = count_and_truncate(&mut xs);
        counter.insert(key, c);
        if xs.is_empty() {break;}
    }
    let mut m = 0;
    for key in counter.keys() {
        let temp = get_default(&counter, *key-1)
            + get_default(&counter, *key)
            + get_default(&counter, *key+1);
        if temp > m {
            m = temp;
        }
    }
    println!("{}", m);
}


fn count_and_truncate(xs: &mut Vec<i32>) -> (i32, i32) {
    let mut cnt = 0;
    let key = &xs[0].clone();
    for x in xs.iter() {
        if x != key {
            break;
        }
        cnt += 1;
    }
    xs.drain(..cnt as usize);
    // println!("{:?}", xs);
    (*key, cnt)
}

fn get_default(hashmap: &HashMap<i32, i32>, key: i32) -> i32 {
    match hashmap.get(&key) {
        None => 0,
        Some(x) => *x,
    }
}
//  [rust]
use std::io;
use std::collections::HashMap;
use std::ops::{Deref, DerefMut};

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).unwrap();
    buffer.clear();
    io::stdin().read_line(&mut buffer).unwrap();
    let mut xs: CountedData = CountedData(
        buffer
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
    );
    
    xs.sort();
    let mut counter = HashMap::new();
    while !xs.is_empty() {
        let (key, c) = xs.count_and_drain();
        counter.insert(key, c);
    }

    let m: i32 = counter.keys().map(
        |key| {
            [-1, 0, 1]
                .iter()
                .map(|x| {
                    match counter.get(&(key + x)) {
                        None => 0,
                        Some(i) => *i,
                    }
                })
                .sum()
        }).max().unwrap();
    
    println!("{}", m);
}

struct CountedData(Vec<i32>);

impl CountedData {
    fn count_and_drain(&mut self) -> (i32, i32) {
        let key = self.0[0].clone();
        let cnt = self.0.iter()
            .take_while(|&&x| x == key)
            .count();
        self.0.drain(..cnt);
        (key, cnt as i32)        
    }
}

impl Deref for CountedData {
    type Target = Vec<i32>;

    fn deref(&self) -> &Vec<i32> {
        &self.0
    }
}

impl DerefMut for CountedData {
    fn deref_mut(&mut self) -> &mut Vec<i32> {
        &mut self.0
    }
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret.sorted()
}

func main() {
    let n = readInt()
    let aryA = readInts().sorted()
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var aryCount = [Int](repeating: 0, count: 1000000)
    
    var left = 0
    var right = 0
    while right < n {
        while right < n && aryA[left] == aryA[right] {
            right += 1
        }
        aryCount[aryA[left]] += right - left
        left = right
    }
    
    var ans = 0
    for i in 1..<aryCount.count - 1 {
        ans = max(ans, aryCount[i + 1] + aryCount[i] + aryCount[i - 1])
    }
    print(ans)
    
    
}
main()
//  [swift]
let N = readLine()
let a = readLine()!.characters.split(" ").map{Int(String($0))!}
var dic = [Int : Int]()
for i in (a + a.map{$0+1} + a.map{$0-1}) {
    if dic[i] == nil {
        dic[i] = 0
    }
    dic[i]! += 1
}
print(dic.values.maxElement()!)
//  [typescript]
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const [[numsCount], nums] = input.split("\n").map(s => s.split(" ").map(Number));


  nums.sort();
  const map = new Map();
  // 同じ数のカウントを値に
  nums.forEach((e) => {
    if(!map.has(e)) {
      map.set(e, 0);
    }
    map.set(e, map.get(e) + 1);
  });

  const ans = Array.from(map).reduce((p, [key, val]) => {
    const nextVal = map.has(key + 1) ? map.get(key + 1) : 0;
    const nextNextVal = map.has(key + 2) ? map.get(key + 2) : 0;
    return Math.max(p, val + nextVal + nextNextVal);
  }, 0);
  console.log(ans);
}
//  [python]
# coding: utf-8

import numpy as np

A = [int(i) for i in input().split()]

A = np.array(sorted(A))

print(sum(A[1:] - A[:2]))
//  [python]
import numpy as np

a = list(map(int,input().split()))
a = np.sort(a)
cos = 0
for k in range(2):
    cos += np.abs(a[k] - a[k+1])
print(cos)
//  [python]
import numpy as np
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
sum = a[0]-a[2]
print (sum)
//  [java]
import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);
	
	void solve(){
		int[]a={s.nextInt(),s.nextInt(),s.nextInt()};
		Arrays.sort(a);
		System.out.println(a[2]-a[0]);
	}

	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}
}
//  [java]
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);
	
	void solve(){
		int[]a=INTS(3).sorted().toArray();
		System.out.println(a[2]-a[0]);
	}

	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}

class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}
	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}
}
//  [cpp]
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
int main() {
	vector<int> v;
	int a1, a2, a3;

	cin >> a1 >> a2 >> a3;
	
	v.push_back(a1);
	v.push_back(a2);
	v.push_back(a3);

	sort(v.begin(), v.end());

	int c=0;

	for (int i=0;i<v.size();++i)
	{
		if (i > 0)
		{
			c += v[i] - v[i - 1];
		}
	}



	cout << c << endl;
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int a,b,c;
  cin>>a>>b>>c;
  int p=abs(a-b)+abs(b-c);
  int q=abs(a-c)+abs(b-c);
  int r=abs(c-a)+abs(a-b);
  int ans=p;
  if(q<ans)ans=q;
  if(r<ans)ans=r;
  cout(ans);
  return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;

int main() {
	int i, A[3], x[3], max,sum, tmp;
	cin >> A[0] >> A[1] >> A[2];
	x[0] = abs( A[2] - A[0]);
	x[1] = abs(A[0] - A[1]);
	x[2] = abs(A[1] - A[2]);
	max = x[2];
	sum = x[2];
	for (i = 0; i < 2; i++) {
		if (max < x[i]) {
			max = x[i];
		}
		sum += x[i];
	}
	cout << sum-max << endl;
}
//  [c]
#include<stdio.h>

int main(void){
  int number[3];
  scanf("%d %d %d",&number[0],&number[1],&number[2]);
  int tmp;
  for (int i=0; i<3; ++i) {
    for (int j=i+1; j<3; ++j) {
      if (number[i] > number[j]) {
        tmp =  number[i];
        number[i] = number[j];
        number[j] = tmp;
      }
    }
  }
  
  printf("%d\n",number[2]-number[0]);
  return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
        int a[3],i,max,min;
        for(i=0;i<3;i++)
                scanf("%d",&a[i]);
        max=a[0];min=a[0];
        for(i=1;i<3;i++){
                if(max<a[i])max=a[i];
                else if(min>a[i]) min=a[i];
        }
        printf("%d\n",max-min);
        return 0;
}
//  [c]
#include <stdio.h>

void swap(int *a,int *b){
  *a^=*b;
  *b^=*a;
  *a^=*b;
  return;
}

int main(){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  if(B<C) swap(&B,&C);
  if(A<B) swap(&A,&B);
  if(B<C) swap(&B,&C);
  printf("%d\n",A-C);
  return 0;
}
//  [javascript]
function main(input) {
    var array = input.split(' ');
    var sortedArray = array.sort(compareNumbers);
    var counter = 0;

    for(var i = 1; i < sortedArray.length; i++){
        counter += sortedArray[i] - sortedArray[i-1];
    }
    console.log(counter);
}

function compareNumbers(a, b) {
    return a - b;
  }

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
'use strict'

function Main(input) {
  let line = input.split(' ').map(x => Number(x));
  line.sort();

  let answer = 0;

  answer = Math.abs(line[1] - line[0]) + Math.abs(line[2] - line[1]);

  console.log(answer);

}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	input = input[0].split(' ');
	var as = toIntArr(input).sort(function(a,b){return a-b});

	console.log(as[2] - as[0]);	
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for A - Task Scheduling Problem
	A := make([]int, 3)
	fmt.Scanf("%d %d %d", &A[0], &A[1], &A[2])

	fmt.Println(math.Max(math.Max(math.Abs(float64(A[1])-float64(A[0])), math.Abs(float64(A[2])-float64(A[0]))), math.Abs(float64(A[1])-float64(A[2]))))

}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b, c := intScanner(), intScanner(), intScanner()
	fmt.Println(max([]int{a, b, c}) - min([]int{a, b, c}))
}
//  [go]
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var a, b, c float64
	fmt.Scan(&a, &b, &c)
	s := []float64{a, b, c}
	sort.Float64s(s)
	fmt.Println(math.Abs(s[0]-s[1]) + math.Abs(s[1]-s[2]))
}
//  [ruby]
a,b,c = gets.chomp.split(' ').map(&:to_i)
l = [(a-b).abs,(b-c).abs,(c-a).abs]
puts l.sum - l.max
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A = get_ints

min = 10 ** 9
A.permutation(3) do |array|
  cost = (array[1] - array[0]).abs + (array[2]-array[1]).abs
  min = cost if cost < min
end

puts min
//  [ruby]
a = gets.split.map(&:to_i)
puts a.max-a.min
//  [rust]
fn main(){
    let a: Vec<i32> = read_vec();
    let c0 = (a[0] - a[1]).abs() + (a[0] - a[2]).abs();
    let c1 = (a[0] - a[2]).abs() + (a[1] - a[2]).abs();
    let c2 = (a[0] - a[1]).abs() + (a[1] - a[2]).abs();
    let b = vec![c0, c1, c2];
    let min_cost = b.iter().min();
    println!("{}", min_cost.unwrap());
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        mut tasks: [i32; 3]
    }
    tasks.sort();
    println!("{}", tasks[2] - tasks[0]);
}
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{ mut a_vec: [isize;3] }

    a_vec.sort();

    println!("{}", (a_vec[0] - a_vec[1]).abs() + (a_vec[1] - a_vec[2]).abs());
}
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let a=asc(nrin(3))
  out(a[2]-a[0])
}
main();
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const A = input[0].map(Number);

  A.sort((a, b) => b - a);

  return Math.abs(A[1] - A[0]) + Math.abs(A[2] - A[1]);
};

console.log(main(read()));
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const A = input[0].map(Number);

  return Math.max(...A) - Math.min(...A);
};

console.log(main(read()));
//  [python]
a,b,c=sorted(map(int,input().split()))
print(a*b//2)
//  [python]
c, a, b = map(int, input().split())
print(a *c //2)
//  [python]
AB, BC, CA = [int(elem) for elem in input().split()]
print(AB * BC // 2)
//  [python]
import numpy as np
ab, bc, ca = list(map(int, input().split()))
ab = np.clip(ab, 1, 100)
bc = np.clip(bc, 1, 100)
ca = np.clip(ca, 1, 100)

area = ab * bc * 0.5
print(int(area))
//  [python]
from numpy import sqrt
a,b,c = [int(x) for x in input().split()]
s = (a+b+c)/2
print(int(sqrt(s*(s-a)*(s-b)*(s-c))))
//  [python]
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 20 20:51:22 2019

@author: Owner
"""

import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*M
Y = [0]*M
for m in range(M):
    P[m], Y[m] = map(int, input().split())
    
all(nstr.count(c) for c in '753')
"""


x = [0]*3
x[:] = map(int, input().split())

x.sort(reverse = False)
print(int(1/2 * x[0]*x[1]))