jiahuimbzuai/CoQuIR huggingface dataset:
//  [c]
/* ex_3-2. nknm */

#include <stdio.h>

int main(void){

    //鉛筆の本数を入力
    int pencils;

    scanf("%d", &pencils);

    //条件により異なる出力
    if (pencils % 10 == 3){
        printf("bon\n");
    }else if(pencils % 10 == 0 || pencils % 10 == 1 || pencils % 10 == 6 || pencils % 10 == 8){
        printf("pon\n");
    }else{
        printf("hon\n");
    }
    
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
int n;
scanf("%d",&n);
if(n%10==3){printf("bon\n");}
else if(n%10==0||n%10==1||n%10==6||n%10==8){printf("pon\n");}
else{printf("hon");}
}
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input)%10;
  var ans = "pon";
  if(N==2||N==4||N==5||N==7||N==9){
    ans="hon";
  }else if(N==3){
    ans="bon";
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(lines) {
    const input = lines.trim().split('')
    const lastNumber = input[input.length-1]
    let output = ''
    if(lastNumber == 2 || lastNumber == 4 || lastNumber == 5 || lastNumber == 7 || lastNumber == 9){
      console.log('hon')
      return;
    } else if (lastNumber == 3) {
      console.log('bon')
      return;
    } else if(lastNumber == 0 || lastNumber == 1 || lastNumber == 6 || lastNumber == 8) {
      console.log('pon')
      return;
    }
  }

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  const N = input[0];
  const n = N[N.length - 1];

  if (n === '3') {
    console.log('bon');
  } else if (n === '0' || n === '1' || n === '6' || n === '8') {
    console.log('pon');
  } else {
    console.log('hon');
  }

}

// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	n := nextLine()
	arr := strings.Split(n, "")
	result := arr[len(arr)-1]
	if result == "3" {
		fmt.Println("bon")
	} else if result == "0" || result == "1" || result == "6" || result == "8" {
		fmt.Println("pon")
	} else {
		fmt.Println("hon")
	}
}
//  [go]
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	n, _ := strconv.Atoi(s)

	switch n % 10 {
	case 2, 4, 5, 7, 9:
		fmt.Println("hon")
	case 0, 1, 6, 8:
		fmt.Println("pon")
	case 3:
		fmt.Println("bon")
	}
}
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
n %= 10 # =
if n == 3
  puts 'bon'
elsif [0,1,6,8].include? n
  puts 'pon'
else
  puts 'hon'
end
//  [ruby]
require 'pp'

n = gets.to_i

case n % 10
when 2,4,5,7,9
    puts "hon"
when 0,1,6,8
    puts "pon"
when 3
    puts "bon"
end
//  [ruby]
number = gets.chomp.to_i % 10
case number
  when 2,4,5,7,9
  	puts "hon"
  when 0,1,6,8
  	puts "pon"
  when 3
  	puts "bon"
end
//  [swift]
import Foundation

let numstr = readLine()!
let last   = String(numstr.last!)

var word = ""
switch Int(last) {
    case 2,4,5,7,9: word = "hon"
    case 0,1,6,8 :  word = "pon"
    case 3:         word = "bon"
    default : break
}

print(word)
//  [swift]
import Foundation
extension String {
    func therefoce() -> String{
        let s = self.suffix(1)
        if s == "3" {return "bon"}
        if s == "0"||s=="1"||s=="6"||s=="8" {return "pon"}
        else {return "hon"}
    }
}

func main(){
    print(readLine()!.therefoce())
}
main()
//  [swift]
let n = cin.int
switch n%10 {
    case 2,4,5,7,9:
        print("hon")
    case 0,1,6,8: 
        print("pon")
    case 3:
        print("bon")
    default:
        break
}

// MARK: #### 以下、ライブラリ ####

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var int: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var str: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { str.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { str.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in int } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

precedencegroup PowerPrecedence { higherThan: MultiplicationPrecedence }
infix operator ^^ : PowerPrecedence
func ^^ (radix: Int, power: Int) -> Int {
    return Int(pow(Double(radix), Double(power)))
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}
//  [typescript]
// import std = require('tstl')

{
  type Print = void | string | number | string[] | number[]
  let outs: Print[] = []

  const main = (): Print => {
    const r = _io()
    const ns = r.s()

    const lib = 'pphbhhphph'

    return lib[Number(ns[ns.length - 1])] + 'on'
  }

  const _io = (i = 0) => {
    const str: string = require('fs').readFileSync('/dev/stdin', 'utf8')
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')

    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map((v) => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  outs.push(main())

  console.log(
    outs
      .map((line) => (typeof line === 'object' ? line.join(' ') : String(line)))
      .join('\n')
  )
}
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const input = Number(lines.shift());

  const amari = input % 10;

  if (amari === 3) {
    console.log("bon");
  } else if (amari === 0 || amari === 1 || amari === 6 || amari === 8) {
    console.log("pon");
  } else {
    console.log("hon");
  }
});
//  [python]
n=int(input())
x=list(map(int,input().split()))

z=[]
for i in range(10**6):
    y=0
    for j in range(n):
        y+=abs(x[j]-i)**2
    z.append(y)

z=sorted(z)
print(z[0])
//  [python]
#!/usr/bin/env python3
# %%
stdin = open(0)
import numpy as np

# %%
data = np.fromstring(stdin.read(), np.int64, sep=' ')

# %%
X = data[1:]
costs = []
for p in range(101):
    costs.append(np.sum((X-p)**2))

# %%
answer = min(costs)
print(answer)

# %%
//  [python]
import numpy as np
n = int(input())
x = input().split()
x = np.array(x,dtype='int')
m = x.sum()
v = (x**2).sum()
pm = int(np.round(m/n))
print(n * pm**2 - 2*pm*m + v)
//  [java]
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner scan = new Scanner(System.in);
		Integer n = scan.nextInt();
		List<Integer> xList = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			xList.add(scan.nextInt());
		}

		int xMax = xList.stream().mapToInt(x -> x).max().getAsInt();
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < xMax; i++) {
			int p = 0;
			for (int j = 0; j < n; j++) {
				int x1 = xList.get(j);
				int x2 = i + 1;
				p += (x1 - x2) * (x1 - x2);
			}
			min = Math.min(p, min);
		}

		System.out.println(min);
		scan.close();
	}
}
//  [java]
import java.util.Arrays;
import java.util.IntSummaryStatistics;
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		int[] X = new int[N];
		for (int i = 0; i < N; i++) {
			X[i] = sc.nextInt();
		}
		IntSummaryStatistics statistics = Arrays.stream(X).summaryStatistics();
		long ceil = (long) Math.ceil(statistics.getAverage());
		long floor = (long) Math.floor(statistics.getAverage());
		long ceilSum = 0;
		long floorSum = 0;
		for (int i = 0; i < N; i++) {
			long C = X[i] - ceil;
			ceilSum += C * C;
			long F = X[i] - floor;
			floorSum += F *F;
		}

		System.out.println(Math.min(ceilSum, floorSum));
	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}
//  [java]
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int[] x = new int[n];
    int min = 100;
    int max = 1;
    for (int i = 0; i < n; i++) {
      int xi = Integer.parseInt(sc.next());
      min = Math.min(min, xi);
      max = Math.max(max, xi);
      x[i] = xi;
    }
    pw.println(
      IntStream.rangeClosed(min, max)
        .map(p -> distance(p, x))
        .min()
        .getAsInt()
    );
  }

  static int distance(int p, int[] x) {
    return Arrays.stream(x)
      .map(xi -> (xi - p) * (xi - p))
      .sum();
  }
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n,k;
ll x[1111];

int main(){
  cin>>n;
  rep(i,n)cin>>x[i];

  ll p=0,tmp=10000000;
  for(ll i=0;i<=1000000;i++){
    ll cnt=0;
    rep(j,n)cnt+=(x[j]-i)*(x[j]-i);
    if(tmp>cnt){
      tmp=cnt;
      p=i;
    }
  }

  cout<<tmp<<endl;
}
//  [cpp]
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
#define DD 1
#else
#define DD 0
#endif
#define Debug if(DD) printf("line %d\n",__LINE__)
#define deb(x) if(DD) cerr<<#x<<'='<<x<<endl
#define debug if(DD) printf
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void gg1(){write2(-1);exit(0);}
	void gg2(){puts("NO");exit(0);}
	
	const double eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int M=5e6+10;
	ll fac[M],facinv[M];ll C(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,M-1) fac[i]=fac[i-1]*i%MOD;
		facinv[M-1]=invm(fac[M-1]);fd(i,M-1,1) facinv[i-1]=facinv[i]*i%MOD;
	}
	
	const int N=1e6+10;
	int x[N];
	void main()
	{PRE();
		int n=qread();fo(i,1,n) x[i]=qread();ll ans=INF;
		fo(now,0,100)
		{
			ll sum=0;fo(i,1,n) sum+=(x[i]-now)*(x[i]-now);
			chmin(ans,sum);
		}write(ans);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	#endif
	srand(time(0));
	mine::main();
	if(DD) cerr<<"\n---------------------Zory-------------------\nTime: " <<1.0*clock()/CLOCKS_PER_SEC<<"s";
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long int keytype;

//quicksort(<#keytype *a#>, <#int first#>, <#int last#>)

void quicksort(keytype a[], long long int first, long long int last){
    long long int i, j;
    keytype x, t;
    
    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int main() {
    long long int n,x[100],i,j,ans=0,min=10000000;
    scanf("%lld",&n);
    for (i=0; i<n; i++) {
        scanf("%lld",&x[i]);
    }
    for (j=1;j<=1000000;j++) {
        ans=0;
        for (i=0; i<n; i++) {
            ans+=((x[i]-j)*(x[i]-j));
        }
        if(ans<min){
            min=ans;
        }
        
    }
    printf("%lld",min);
    return 0;
}
//  [c]
#include<stdio.h>

int main(){

        int n,x[100],sum1,sum2;

        sum1 = 0;
        sum2 = 0;

        scanf("%d",&n);


        for(int i = 0 ; i < n ; i++){
                scanf("%d",&x[i]);
                sum1 += x[i];
                sum2 += x[i]*x[i];
        }


        if( sum1%n == 0 )
                printf("%d\n",sum2-sum1*sum1/n);
        else {
                double p,diff;
                int P,ansP;

                p = (double)sum1/(double)n ;
                P = sum1/n ;
                diff = p - (double)P;

                if(diff > 0.5)
                        ansP = P+1;
                else
                        ansP = P;

                printf("%d\n",n*ansP*ansP-2*sum1*ansP+sum2);

        }


        return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>

int main()
{
    int n, p;
    double average = 0;
    long long int power = 0;
    int x[100];

    scanf("%d", &n);

    for (int i = 0; i<n; i++)
    {
        scanf("%d", &x[i]);

        average += (double)x[i];
    
    }

    p = (int)(average/n + 0.5);

    for (int i = 0; i<n; i++)
    {
        power += (x[i] - p)*(x[i] - p);
    }

    printf("%lld", power);

    return 0;
}
//  [javascript]
function Main(input) {
	input = input.split("\n");
	var N = input[0];
	var arr = input[1].split(" ").map(Number);
	var ans = Number.MAX_SAFE_INTEGER;
	var max = Math.max.apply(null,arr);
	
		for(var i=1;i<=max;i++){
			var sum = 0;
			for(var j=0;j<arr.length;j++){
				sum += Math.pow(Math.abs(arr[j]-i),2);
			}
         // console.log(i,sum)
			if(sum<ans) ans = sum;
		}
console.log(ans);

}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
"use strict"
function main(arg) {
    var data = arg.trim().split("\n")[1].split(" ").map(Number)
    var N = data.length
    data = data.sort((a,b) => b - a )
    var sum = 0
    for (var i = 0; i < data.length; i++) {
        sum += data[i]
    }
    var tmp = Math.floor(sum / N)
    // console.log(tmp)
    console.log(Math.min(
        calc(data, tmp),
        calc(data, tmp + 1)
    ))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function calc(data, p) {
    var sum = 0
    for (var i = 0; i < data.length; i++) {
        sum += Math.pow((data[i] - p), 2)
    }
    return sum
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	
	//文字列から10進数に変換するときはparseIntを使います
	var n = parseInt(input[0], 10);
    var x = input[1].split(" ");
    var min = 0;
    var maxx = 0;
    for(var i = 0;i<n;i++){
        if(maxx<x[i]){
            maxx = x[i];
        }
    }
    for(var j=1;j<=maxx;j++){
        var s = 0;
        for(var k = 0;k<n;k++){
            s=s+((x[k]-j)*(x[k]-j));
        }
        if(min==0 || min >s){
            min=s;
        }
    }
    //出力
    console.log('%d',min);
	
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000009
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	var sum, sc, st int
	Xn := make([]int, N)
	for i := 0; i < N; i++ {
		Xn[i] = nextInt()
		sum += Xn[i]
	}
	ave := float64(sum) / float64(N)
	for i := 0; i < N; i++ {
		sc += int(math.Pow((float64(Xn[i]) - math.Ceil(ave)), 2.0))
		st += int(math.Pow((float64(Xn[i]) - math.Trunc(ave)), 2.0))
	}
	ans := MinOf(sc, st)
	fmt.Println(ans)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}
//  [go]
package main

import "fmt"

func main() {
	n, an := 0, 1<<63-1
	var x []int

	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		tmp := 0
		fmt.Scanf("%d", &tmp)
		x = append(x, tmp)
	}

	for i := 1; i <= 100; i++ {
		an1 := 0
		for _, j := range x {
			an1 += (j - i) * (j - i)
		}
		if an > an1 {
			an = an1
		}
	}
	fmt.Println(an)
}
//  [go]
package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	X := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &X[i])
	}

	var sum int
	var result int = 1000000
	for i := 1; i <= 100; i++ {
		sum = 0
		for k := 0; k < N; k++ {
			sum = sum + (X[k]-i)*(X[k]-i)
		}
		if result > sum {
			result = sum
		}
	}
	fmt.Println(result)
}
//  [ruby]
require 'set'; require 'prime'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
x = gets.chomp.split.map(&:to_i)

ans = INF
1.upto(100) do |i|
  cost = 0
  n.times do |j|
    cost += (i-x[j])**2
  end
  ans = cost if ans > cost
end

puts ans
//  [ruby]
n = gets.to_i
X = gets.chomp.split(' ').map(&:to_i).sort
powers = []

(X[0]..X[-1]).each do |point|
  power = 0
  X.each do |x|
    power += ((point-x)**2).abs
  end
  powers << power
end
puts powers.min
//  [ruby]
n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
k = arr.min
min = arr.map{|i| (i - k)**2}.sum
while k <= arr.max
  if min > arr.map{|i| (i - k)**2}.sum
    min = arr.map{|i| (i - k)**2}.sum
  end
  k += 1
end
puts min
//  [typescript]
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    let n;
    let xn;
    let ans;
    // init
    n = Number(input.shift());
    xn = input.shift().split(" ").map(x => Number(x));
    // solve
    ans = Number.MAX_SAFE_INTEGER;
    for (var px = 1; px <= 100; px++) {
        let w = 0;
        for (var nx = 0; nx < n; nx++) {
            w += (xn[nx] - px) * (xn[nx] - px);
        }
        ans = Math.min(ans, w);
    }
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        let input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            let input = lines;
            main(input);
        });
    }
}
entrypoint();
//  [typescript]
import * as fs from "fs";

const [_, line2] = fs.readFileSync("/dev/stdin", "utf8").split("\n");
const X = line2.split(" ").map(Number);


function totalStamina(P: number): number {
	return X.reduce((S, x) => {
		return S+(x-P)*(x-P);
	}, 0);
}

let minimumStamina: number = Infinity;

for (let P=0; P<101; P++) {
	minimumStamina = Math.min(minimumStamina, totalStamina(P));
}

console.log(minimumStamina);
//  [typescript]
// 最小の集合場所の座標はどこかわからないので、
// 総当たりで場所を探し一番コストが少ない場所を集合場所の座標とする

// inputに入力データ全体が入る
function Main(inputString) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    let inputLineArray = inputString.split("\n");

    // 住んでる座標の文字列配列
    let livingPointStringArray = inputLineArray[1].split(" ");

    // 想定される最小の移動コスト
    let minRequiredPhysicalStrength = 999999;

    // 住んでる座標の文字列配列を数値配列に変換する
    let livingPointArray = [];
    livingPointStringArray.forEach( element => {
        let livingPoint = parseInt( element, 10)
        livingPointArray.push(livingPoint); 
    });

    // 住んでる座標のうち、最小値と最大値を求める
    let minLivingPoint = Math.min.apply( null, livingPointArray);
    let maxLivingPoint = Math.max.apply( null, livingPointArray);

   // 移動コストが最小の座標を求める
    for( i = minLivingPoint; i <= maxLivingPoint; i++ ){
        let tmpMeetingPoint = i;
        let beforeMinRequiredPhysicalStrength = minRequiredPhysicalStrength;
        minRequiredPhysicalStrength = requiredPhysicalStrengthFunction(livingPointArray, tmpMeetingPoint, minRequiredPhysicalStrength);
        // 関数実行前後で値が変わっていなければこれ以上やっても意味ないのでbreakする
        if ( beforeMinRequiredPhysicalStrength === minRequiredPhysicalStrength) {
            break;
        }
    }
    console.log('%d', minRequiredPhysicalStrength);
}

    // 必要な体力を計算する関数
function requiredPhysicalStrengthFunction(in_livingPointArray, in_meetingPoint, in_minRequiredPhysicalStrength){
    // 必要な体力の合計値
    let tmpAllRequiredPhysicalStrength = 0;

    // 住んでる座標の配列
    in_livingPointArray.forEach( livingPoint => {
        //必要な体力は(住んでる座標 - 集合場所の候補の座標)の2乗
        let requiredPhysicalStrength = Math.pow(( livingPoint - in_meetingPoint ) , 2);
        tmpAllRequiredPhysicalStrength += requiredPhysicalStrength;
    });
    // 一番小さいと思っている消費コストより今回の座標の消費コストの方が小さければそれを最小値とする
    if(in_minRequiredPhysicalStrength > tmpAllRequiredPhysicalStrength){
        return tmpAllRequiredPhysicalStrength;
    } else {
        return in_minRequiredPhysicalStrength;
    }
}

    //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
n,m = map(int, input().split())
a_list = []
for i in range(m):
    a_list.append(int(input()))

# memo = [-1 for _ in range(n)]
step_now = 0
step_1   = 0
step_2   = 0
DIV_NUM = 1000000007
if 1 in a_list:
    a_list.pop(0)
    step_now = 0
else:
    step_now = 1
for i in range(1, n):
    if i == 1:
        step_1 = step_now
        if i+1 in a_list:
            a_list.pop(0)
            step_now = 0
        else:
#             memo[i] = (memo[0] + 1) % DIV_NUM
            step_now = step_1 + 1
    else:
        step_2 = step_1
        step_1 = step_now
        if i+1 in a_list:
            a_list.pop(0)
            step_now = 0
        else:
#             memo[i] = (memo[i-1] + memo[i-2]) % DIV_NUM
            step_now = (step_1 + step_2) % DIV_NUM
    if step_now ==  step_1 == step_2 == 0:
        break

print(step_now)
//  [python]
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in a:
    if i+1 in a:
        print(0)
        exit()

for i in a:
    dp[i] = 0
if dp[1] == 0:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])
//  [python]
n, m = list(map(int,input().split()))
a = []
for i in range(m):
  a.append(int(input()))
c = [0] * (n+2) #combination
for i in a:
  c[i] = -1
c[0] = 1

for i in range(n):
    if c[i] < 0:
      continue
    if c[i+1] >= 0:
        c[i+1] = c[i] + c[i+1]
    if c[i+2] >= 0:
        c[i+2] = c[i] + c[i+2]
    c[i] = c[i] % 10**9+7
print(c[n]%(10**9+7))
//  [java]

import java.util.Scanner;
import java.math.BigInteger;

public class Main {
	static int[] breaks;
	static int num;
	static BigInteger[] patterns;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		num = sc.nextInt();
		int m = sc.nextInt();
		breaks = new int[m];
		patterns = new BigInteger[num + 3];
		for(int i = 0; i < m; i++){
			breaks[i] = sc.nextInt();
		}
		BigInteger devider = new BigInteger("1000000007");
		System.out.println(pattern(0).remainder(devider).longValue());
	}
	static BigInteger pattern(int p){
		if(patterns[p] != null){
			return patterns[p];
		}
		if(p == num){
			patterns[p] = BigInteger.ONE;
			return patterns[p];
		}
		if(p > num){
			patterns[p] = BigInteger.ZERO;
			return patterns[p];
		}
		for(int i = 0; i < breaks.length; i++){
			if(p == breaks[i]){
				patterns[p] = BigInteger.ZERO;
				return patterns[p];
			}
		}
		patterns[p] = pattern(p + 1).add(pattern(p + 2));
		return patterns[p];
	}
}
//  [java]
import java.math.BigInteger;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	Integer steps[];
	Map<Integer, BigInteger> map;

	public Main(int n, Integer a[]) {
		steps = new Integer[n];
		map = new TreeMap<>();
		for (int i = 0; i < steps.length; i++) {
			steps[i] = 1;
		}
		for (int e : a) {
			steps[e] = 0;
		}

	}

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int m = s.nextInt();
		Integer a[] = new Integer[m];
		for (int i = 0; i < m; i++) {
			a[i] = s.nextInt();
		}
		System.out.println(
				new Main(n, a).calc(0).mod(new BigInteger("1000000007")));
	}

	public BigInteger calc(int prefix) {
		BigInteger shortcut = map.get(prefix);
		BigInteger result;
		if (shortcut != null) {
			return shortcut;
		}
		if (prefix >= steps.length) {
			result = BigInteger.ZERO;
		} else if (prefix == steps.length - 1) {
			result = BigInteger.ONE;
		} else if (prefix == steps.length - 2) {
			result = BigInteger.ONE
					.add(((steps[prefix + 1] == 1) ? BigInteger.ONE
							: BigInteger.ZERO));
		} else {
			result = ((steps[prefix + 1] == 1) ? calc(prefix + 1)
					: BigInteger.ZERO)
							.add((steps[prefix + 2] == 1) ? calc(prefix + 2)
									: BigInteger.ZERO);
		}
		map.put(prefix, result);
		return result;
	}
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1000000007;

ll F(int x){
	ll dp[100000] = {0};
	dp[0] = 1;
	dp[1] = 1;
	for(int i = 2; i <= x; i++){
		dp[i] = dp[i-1] + dp[i-2];
    dp[i]%=INF;
	}
	return dp[x];
}

int main() {
 int n,m; cin >> n >> m;
 if(m==0){
   cout << F(n) << endl;
   return 0;
 }
 vector<int> s(m);
  cin >>s[0];
 for(int i=1;i<m;i++){
   cin >> s[i];
    if(s[i]-s[i-1]==1){
      cout << 0 << endl;
      return 0;
    }
 }

 ll ans=F(s[0]-1);ans%=INF;
 for(int i=1;i<m;i++){
   ans*=F(s[i]-s[i-1]-2);
   ans%=INF;

 }
 ans*=F(n-s[m-1]-1);
 ans%=INF;
 cout << ans << endl;
}
//  [cpp]
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
typedef vector<int> vi;

const ll MOD = 1000000007;

const int N_MAX = 100010;

template<typename T>
bool isInExist(const T& c, const typename T::value_type& v) {
    return (c.end() != find(c.begin(),c.end(),v));
}

ll ModAdd(ll a, ll b) {
    return (a + b) % MOD;
}

int main() {
    int N, M, tmp;
    vi a(M);

    cin >> N >> M;
    REP(i, M) {
        cin >> tmp;
        a.emplace_back(tmp);
    }

    ll dp[N_MAX];
    REP(i, N_MAX) {
        dp[i] = 0;
    }
    dp[0] = 1;

    bool flag1 = false;
    bool flag2 = false;

    vi::iterator tmp_itr = a.begin();

    for (int i=0; i<N; ++i) {
        auto find_itr_1 = find(tmp_itr, a.end(),i+1);
        flag1 = (find_itr_1 != a.end());
        if (flag1) {
            tmp_itr = find_itr_1;
        }

        if (!flag1) {
            dp[i+1] = ModAdd(dp[i+1], dp[i]);
        }

        auto find_itr_2 = find(tmp_itr, a.end(),i+2);
        flag2 = (find_itr_2 != a.end());
    
        if (flag1 && flag2) {
            cout << 0 << endl;
            return 0;
        }
       
        if (!flag2) {
            dp[i+2] = ModAdd(dp[i+2], dp[i]);
        }
    }

    cout << dp[N] << endl;

    return 0;
}
//  [c]
#include <stdio.h>
#include <stdbool.h>

int main() {
	long long int i, j = 1, n, m, fibo = 1, fi = 1, f = 0, a[100000], sum = 1;
	bool flag = true;

	// 壊れている床の数
	scanf("%lld %lld", &n, &m);

	// 壊れている床の段
	a[0] = -1;
	for (i = 1; i <= m; i++) {
		scanf("%lld", &a[i]);
	}

	// 登れるかチェック
	for (i = 1; i <= m; i++) {
		if (a[i] - a[i - 1] == 1) {
			printf("0\n");
			return 0;
		}
	}

	for (i = 1; i <= n; i++) {
		flag = true;
		for (j = 1; j <= m; j++) {
			if (a[j] == i) {
				a[j] = 0;
				flag = false;
				sum = (sum * fibo) % 1000000007;
				fibo = 1;
				fi = 1;
				f = 0;
				i++;
				break;
			}
		}
		if (flag == true) {
			fibo = (fi + f) % 1000000007;
			f = fi;
			fi = fibo;
		}
	}
	sum = (sum * fibo) % 1000000007;

	printf("%lld\n", sum % 1000000007);

	return 0;
}
//  [c]
#include<stdio.h>

int main(void){
    int n, m;
    scanf("%d %d",&n ,&m);
    int a[m];
    int b[n];
    int i, j, k=0;
    int flag;
    int ans;
    for(i=0;i<m;i++){
        scanf("%d",&a[i]);
    }

    // shokichi
    if(a[0] == 1 && a[1] == 2){
        printf("0");
        return 0;
    }
    if(a[0] == 2){
        b[0] = 1;
        b[1] = 0;
    }
    else if(a[0] == 1 && a[1] != 2){
        b[0] = 0;
        b[1] = 1;
    }
    else{
        b[0] = 1;
        b[1] = 2;
    }

    //keisan
    for(i=0;i<n-2;i++){
        b[i+2] = b[i+1] + b[i];
        for(j=k;j<m;j++){
            if(a[j] == i+3){
                flag++;
                k = j;
                break;
            }
        }
        if(flag == 1){
            b[i+2] = 0;
            flag--;
        }
        b[i+2] = b[i+2]%1000000007;
    }

    ans = b[n-1];
    printf("%d\n",ans);
    return 0;
    
}
//  [c]
#include <stdio.h>
int main(void){
    // Your code here!
    int i, j, n, m;
    int dp[100002];
    int flag;
    int a[100002];
    int js = 0;

    scanf("%d %d", &n, &m);

    for (i = 0; i < m; i++) {
        scanf("%d", &a[i]);
    }
    dp[0] = 1;

    flag = 0;
    for (j = 0; j < m; j++) {
        if (1 == a[j]) {
            flag = 1;
            break;
        }
    }
    if (flag) {
        dp[1] = 0;
    } else {
        dp[1] = 1;
    }


    for (i = 2; i <= n; i++) {
        flag = 0;
        for (j = js; j < m; j++) {
            if (i == a[j]) {
                flag = 1;
                js = j + 1;
                break;
            }
        }
        if (flag) {
            dp[i] = 0;
            continue;
        }
        dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007;
    }
    printf("%d\n", dp[n]);

    return 0;
}
//  [javascript]
function spilitInput(input, to_int) {
  if (typeof to_int === 'undefined') to_int = false;
  var splited = [];
  var rows = input.split('\n');
  for (var i = 0; i < rows.length; i += 1) {
    if (to_int) {
      splited.push(rows[i].split(' ').map(function(d){return parseInt(d,10);}));
    } else {
      splited.push(rows[i].split(' '));
    }
  }
  return splited;
}

function initDp(N, init_n) { return Array(N+2).fill(init_n); }
function chmin(a, b) { if (a > b) a = b; }
function chmax(a, b) { if (a < b) a = b; }

function Main(input) {
  var splited = spilitInput(input, true);
  var N = splited[0][0];
  var hasons = [];
  for (var i = 1; i < splited.length; i += 1) {
    hasons.push(splited[i][0]);
  }
    
  var dp = initDp(N, 0);
  dp[0] = 1;
  
  for (var i = 1; i <= N; i += 1) {
    if (hasons[0] == i) {
      hasons.shift();
      continue;
    }
    dp[i] += dp[i - 1];
    if (i >= 2) dp[i] += dp[i - 2];
    dp[i] %= 1000000007;
  }

  console.log(dp[N]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    
    let N = parseInt(input[0].split(" ")[0]);
    
    input.shift();
    let a = new Set(input.map(Number)); //NG段
    let cost = Array(N + 1).fill(0n);
    cost[0] = 1n;
    cost[1] = a.has(1) ? 0n : 1n; //cost[i] -> i段目まで登る移動方法
    
    for (let i = 2; i < N + 1; i++) {
        
        if (!a.has(i)) {
        	cost[i] += cost[i - 1];
       		cost[i] += cost[i - 2];
        }
        
    }
    
    console.log(String(cost[N] % 1000000007n));
    
}
    
function chkmin(a, b){
    
    if (a > b) return b;
    else return a;
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [N, M] = nextIntArray()
    let a = new Set()
    while(hasNext()){
        a.add(nextInt())
    }
    let dp = {}
    dp[0] = 1n
    if(a.has(1)) dp[1] = 0n
    else dp[1] = 1n
    for(let i = 2;i<=N; i++){
        if(a.has(i)) dp[i] = 0n
        else {
            dp[i] = dp[i-1] + dp[i-2]
        }        
    }
    console.log(Number(dp[N] % 1000000007n))
}
Main()
//  [go]
package main

import (
	"fmt"
)

func main() {

	var n, m int
	fmt.Scanf("%d %d", &n, &m)

	broken := map[int]struct{}{}
	for i := 0; i < m; i++ {
		var a int
		fmt.Scanf("%d", &a)
		broken[a] = struct{}{}
	}

	mod := 1000000007
	step := make([]int, n+1)
	step[0] = 1
	if _, isHole := broken[1]; isHole {
		step[1] = 0
	} else {
		step[1] = 1
	}
	for i := 2; i <= n; i++ {
		if _, isHole := broken[i]; isHole {
			step[i] = 0
		} else {
			step[i] = (step[i-1] + step[i-2]) % mod
		}
	}

	fmt.Printf("%d\n", step[n])
}
//  [go]
package main

import (
	"fmt"
)

func COM(n, k int64) int64 {
	r := int64(1)
	for i := int64(0); i < k; i++ {
		r = ModMul(r, n-i)
		r = ModDiv(r, i+1)
	}

	return r
}

const (
	MOD = 1000000000 + 7
)

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	value int
	index int
	A, B  int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int64) int64 {
	return a * b / GCD(a, b)
}

func main() {
	var N, M int
	fmt.Scanf("%d %d\n", &N, &M)
	m := map[int]bool{}
	for i := 0; i < M; i++ {
		var w int
		fmt.Scanf("%d\n", &w)
		m[w] = true
	}
	dp := [1000000]int{}
	dp[0] = 1
	for i := 0; i <= N; i++ {
		for j := i + 1; j <= N && j <= i+2; j++ {
			if m[j] {
				continue
			}
			dp[j] += dp[i]
			dp[j] %= MOD
		}
	}
	fmt.Println(dp[N])
}

func Reverse(runes []rune) []rune {
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return runes
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var N, M int
	fmt.Scanf("%d %d\n", &N, &M)
	A := make(map[int]bool)
	answer := make([]int, N+1, N+1)
	for i := 0; i < M; i++ {
		var a int = -1
		fmt.Scanf("%d\n", &a)
		A[a] = true
	}

	answer[0] = 1
	if A[1] {
		answer[1] = 0
	} else {
		answer[1] = 1
	}
	for s := 2; s <= N; s++ {
		if A[s] {
			answer[s] = 0
		} else {
			answer[s] = (answer[s-2] + answer[s-1]) % 1000000007
		}
	}
	fmt.Printf("%d\n", answer[N])
}
//  [ruby]
n, m = gets.chomp.split(" ").map(&:to_i)
a = [0]
1.upto(m) do |i|
  a[i] = gets.chomp.to_i
end

def combi2(n, k)
  $memo ||= {}
  key = "#{n},#{k}"
  return $memo[key] if $memo[key]
  num1 = 1
  num2 = 1
  1.upto(k) do |i|
    num1 *= (n - i + 1)
    num2 *= i
  end
  num = num1 / num2
  $memo[key] = num
  num
end

def n_pattern2(d)
  return 1 if d.zero?
  c = 0
  cc = nil
  0.upto(d / 2) do |i|
    n2 = i
    n1 = d - 2 * i
    nn = n1 + n2
    if n1.zero? || n2.zero?
      c += 1
    else
      if cc
        cl = nn
        cr = n2
        cc = cc * ((cl - cr + 1)..(cl - cr + 2)).inject(1, :*) / ((cl + 1) * cr)
        c += cc
      else
        cc = combi2(nn, n2)
        c += cc
      end
    end
  end
  c
end

c = 1
cur = 0
1.upto(m) do |i|
  if a[i] == cur
    puts 0
    exit
  end
  d = a[i] - cur - 1
  c *= n_pattern2(d)
  cur += d + 2
end
d = n - cur
c *= n_pattern2(d)
puts c % 1_000_000_007
//  [ruby]
n, m = gets.split.map &:to_i
A = Array.new(m){gets.to_i}

dp = Array.new(n+2,0)
dp[0] = 1
m.times do |i|
  dp[A[i]] = nil
end

0.upto(n-1) do |i|
  1.upto(2) do |j|
    if dp[i] && dp[i+j]
      dp[i+j] += dp[i]
    end
  end
  
end

  p dp[n] % 1000000007
//  [ruby]
n, m = gets.strip.split.map(&:to_i)
holes = m.times.map { gets.to_i }
stairs = Hash.new { 0 }
holes.each do |hole|
  stairs[hole] = false
end

stairs[0] = 1

n.times do |i|
  if stairs[i]
    if stairs[i + 1]
      stairs[i + 1] += stairs[i]
    end
    if stairs[i + 2]
      stairs[i + 2] += stairs[i]
    end
  end
end

puts(stairs[n] % 1_000_000_007)
//  [rust]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use std::cmp::max;
use im_rc::HashSet;

fn main() {
    input! {
    n: usize,
    m: usize,
    a: [usize; m]
    }
    let set_a = a.into_iter().collect::<HashSet<usize>>();
    let p = 1_000_000_007;
    let mut dp = vec![0; n + 1];
    dp[0] = 1;
    if !set_a.contains(&1) {dp[1] = 1}
    for i in 2..=n {
        if set_a.contains(&i){ continue }
        dp[i] = dp[i - 1] + dp[i - 2];
        dp[i] %= p;
    }
    println!("{}", dp[n]);
}
//  [rust]
fn solve() {
    let n: usize = read();
    let m = read();
    let mut a: HashSet<usize> = HashSet::new();
    for i in 0..m {
        a.insert(read::<usize>() - 1);
    }
    // -1, 0, 1, ... n
    let mut anss = vec![0; n + 2];
    anss[1] = 1;
    for i in 2..n + 2 {
        if !a.contains(&(i - 2)) {
            anss[i] = (anss[i - 1] + anss[i - 2]) % MOD;
        }
    }
    println!("{}", anss[n + 1]);
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Reverse};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1_000_000_007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========
//  [rust]
#[allow(dead_code)]
fn main() {
    let (n, m) = i::u2();

    let mut a = HashSet::new();
    for _ in 0..m {
        a.insert(i::u());
    }

    let mut dp = vec![1usize];
    if !a.contains(&1) {
        dp.push(1);
    } else {
        dp.push(0);
    }
    for i in 2..(n + 1) {
        if a.contains(&i) {
            dp.push(0);
            continue;
        }
        let t = (dp[i - 1] + dp[i - 2]) % 1_000_000_007;
        dp.push(t);
    }
    println!("{}", dp[n]);
    // dbg!(dp);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}
//  [swift]
/// Swift5 -> Swift2.2

extension String {
    // split(separator:maxSplits:omittingEmptySubsequences:)
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map(String.init)
    }
}
extension Array {
    // init(repeating:count:)
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
    // lastIndex(where:)
    func lastIndex(where predicate: (Element) -> Bool) -> Int? {
      	for i in stride(from: count - 1, through: 0, by: -1) {
          	if predicate(self[i]) {
              	return i
            }
        }
      	return nil
    }
}
extension Array where Element: Comparable {
    // sorted()
    func sorted() -> [Element] {
        return self.sort( { $0 < $1 } )
    }
    // max()
    func max() -> Element? {
        guard self.count > 0 else { return nil }
        return self.reduce(self.first!) { return Swift.max($0, $1) }
    }
}
extension String {
    // Sequence#enumerated()
  	// public func enumerate<Seq : SequenceType>(base: Seq) -> EnumerateSequence<Seq>
    func enumerated() -> EnumerateSequence<[Character]> {
        return Array(self.characters).enumerate()
    }
}
// stride(from:through:by:)
func stride(from start: Int, through end: Int, by stride: Int) -> StrideThrough<Int> {
    return start.stride(through: end, by: stride)
}
// stride(from:to:by)
func stride(from start: Int, to end: Int, by stride: Int) -> StrideTo<Int> {
    return start.stride(to: end, by: stride)
}

/// end

let input = readLine()!.split(separator: " ").map { Int($0)! }
let N = input[0]
let M = input[1]

var a = [Int]()

for _ in stride(from: 0, to: M, by: 1) {
    a.append(Int(readLine()!)!)
}

var dp = Array(repeating: Optional<Int>.None, count: N + 1)
dp[0] = 1

for i in stride(from: 1, through: N, by: 1) {
    guard i != a.first else {
        a.removeFirst(1)
        continue
    }
    guard i > 1 else {
        dp[1] = 1
        continue
    }

    switch (dp[i - 1], dp[i - 2]) {
    case (.Some(let one), .Some(let two)):
        dp[i] = (one + two) % 1_000_000_007
    case (.Some(let one), .None):
        dp[i] = one
    case (.None, .Some(let two)):
        dp[i] = two
    default:
        break
    }
}

print(dp.last! ?? 0)
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (N, M) = (input[0], input[1])
var steps = (0...N).map{_ in 0}
(0..<M).forEach{_ in steps[Int(readLine()!)!] = 1}
var dp = (0...N+1).map{_ in 0}
dp[N] = 1
for i in (0..<N).reverse() {
    if steps[i] == 0 {
        dp[i] = (dp[i+1] + dp[i+2]) % 1000000007
    }
}
print(dp[0])
//  [typescript]
import { readFileSync } from 'fs'

const range = (n: number) => Array(n).fill(null).map((_, i) => i)

function main(input: string) {
  const [[N, M], ...lines] = input.split('\n').map(v => v.split(' ').map(Number))

  const set = new Set(lines.map(([v]) => v))
  const memo = {} as Record<number, number>

  const fn = (n: number) => {
    if (n < 0) return 0
    if (n == 0) return 1
    if (n in memo) return memo[n]

    const list = [n - 1, n - 2].filter(v => !set.has(v))
    const result = list.map(v => fn(v)).reduce((a, b) => a + b, 0)

    return memo[n] = result % 1000000007
  }

  // メモ化を利用して、再帰上限を回避
  range(N).forEach(v => fn(v))

  console.log(fn(N))
}

main(readFileSync('/dev/stdin', 'utf8').trim())
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const MOD = 1000000007

const [n, m] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const a = stdin
  .split('\n')
  .map(Number)
  .slice(1)

const A = new Set(a)

const ans = () => {
  const steps = A.has(1) ? [1, 0] : [1, 1]

  for (let i = 2; i <= n; i++) {
    if (A.has(i)) {
      steps[i] = 0
    } else if (steps[i - 1] === 0 && steps[i - 2] === 0) {
      return 0
    } else {
      steps[i] = (steps[i - 1] + steps[i - 2]) % MOD
    }
  }

  const last = steps[n]

  return last
}

console.log(ans())