jiahuimbzuai/CoQuIR huggingface dataset:
//  [java]

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws IOException{
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(in.readLine());
        int k=n%10;
        if(k==2 || k==4 || k==5 || k==7 || k==9)
            System.out.println("hon");
        else if(k==3)
            System.out.println("bon");
        else
            System.out.println("pon");
    }
}
//  [java]
import java.io.*;
import java.util.*;
import java.lang.*;

class Main {

	public static void main(String[] args) {
		final FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		switch (n % 10) {
			case 2:
			case 4:
			case 5:
			case 7:
			case 9:
				System.out.println("hon");
				break;
			case 0:
			case 1:
			case 6:
			case 8:
				System.out.println("pon");
				break;
			case 3:
				System.out.println("bon");
		}
	}

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}
//  [java]
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		int k = n%10;
 		if (k == 3)
 			out.println("bon");
 		else if (k == 0 || k == 1 || k == 6 || k == 8)
 			out.println("pon");
 		else
 			out.println("hon");
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is
//  [java]
import java.util.Scanner;

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

        int lastIndex = number.length() - 1;
        char lastChar = number.charAt(lastIndex);

        String ans = "";
        if (lastChar == 2 || lastChar == 4 || lastChar == 5 || lastChar == 7 || lastChar == 9) {
            ans = "hon";
        } else if (lastChar == 0 || lastChar == 1 || lastChar == 6 || lastChar == 8) {
            ans = "pon";
        } else  {
            ans = "bon";
        }
        System.out.println(ans);
    }
}
//  [java]
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        switch (N) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                System.out.println("hon");
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                System.out.println("pon");
                break;
            case 3:
                System.out.println("bon");
        }
    }
}
//  [java]
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        switch (n) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                System.out.println("hon");
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                System.out.println("pon");
                break;
            case 3:
                System.out.println("bon");
        }
    }
}
//  [cpp]
#include<cstdio>
using namespace std;
int main()
{
	int N, c;
	scanf("%d", &N);

		c=N%10;

	if(c==3) printf("bon");
	if(c==2||c==4||c==5||c==7||c==9) printf("hon");
	if(c==0||c==1||c==6||c==8) printf("pon");
	return 0;
 }
//  [cpp]
#include <stdio.h>

int main(void) {

    int N; /*入力*/

    scanf("%d", &N);

    N = N % 10; /*1の位*/

    if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9) {
        printf("hon");
    }else if (N == 0 || N == 1 || N == 6 || N == 8) {
        printf("pon");
    }else{
        printf("bon");
    };

    return 0;
}
//  [cpp]
#include <cstdio>

int main() {
  int n;
  scanf("%d", &n);
  int k = n % 10;
  if(k == 3) {
    puts("bon");
  } else if(k == 0 || k == 1 || k == 6 || k == 8) {
    puts("pon");
  } else {
    puts("hon");
  }
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
# define LL long long

int main(){
    float a,b,h,m, x;
    scanf("%f%f%f%f",&a,&b,&h,&m);
    float y=m/2;
    if (h*5>=m){
        x=((h*5)-m)*6+y;
    }
    else{
        x=(m-(h*5))*6+y;
    }
    float ans=sqrt((a*a)+(b*b)-(2*a*b*cos(x* M_PI /180.0)));
    cout<<setprecision(20)<<fixed;
    cout<<ans;
}
// 9899901000000100
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
ll mod=1e9+7;
ll power(ll a,ll b)
{
    ll result=1;
    while(b>0)
    {
        if(b%2==1)
        {
            result=(result*a)%mod;   
        }
        b/=2;
        a=(a*a)%mod;
    }
    return result;
}
int main()
{
    
    vector<ll> powe(3e5,0);
    powe[0]=1;
    for(int i=1;i<3e5;i++)
    {
        powe[i]=(powe[i-1]*2)%mod;
    }
    int n;
    cin>>n;
    vector<pair<ll,ll> > a(n);
    map<pair<ll,ll>,int> m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i].first>>a[i].second;
       
        ll p=__gcd(a[i].first,a[i].second);
        a[i].first/=p;
        a[i].second/=p;
         if(a[i].first>0&&a[i].second<0)
        {
            a[i].first=-a[i].first;
            a[i].second=-a[i].second;
        }
        if(a[i].second<0&&a[i].first<0)
        {
            a[i].second=-a[i].second;
            a[i].first=-a[i].first;
        }
        m[a[i]]++;
    }
    ll ans=1;
    // cout<<endl;
    for(auto it:m)
    {
        // cout<<it.first.first<<" "<<it.first.second<<endl;
        if(it.first.first<0)
        {
            if(m.find({it.first.second,-it.first.first})==m.end())
            ans=(ans*(it.second+1))%mod;
            // cout<<ans<<endl;
            continue;
        }
        ll p=it.second;
        ll q=0;
        if(m.find({-it.first.second,it.first.first})!=m.end());
        {
            q=m[{-it.first.second,it.first.first}];
        }
       
        ll res=(powe[p]-1+powe[q]-1)%mod;
        ans=(ans*(res+1))%mod;
        // cout<<ans<<endl;
    }
    cout<<ans-1<<endl;
    
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const inf INF = 1001001001;
vector<int> to[100005]

int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m){
        int a, b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    queue<int> q;
    vector<int> dist(n, INF);
    vector<int> pre(n, -1);
    dist[0] = 0;
    q.push(0);
    while(!q.empty()){
        int v = q.front(); q.pop();
        for (int u: to[v]){
            if(dist[u] != INF) continue;
            dist[u] = dist[v] + 1;
            pre[u] = v;
            q.push(u);
        }
    }

    cout << "Yes" << endl;
    rep(i, n){
        if(i == 0) continue;
        int ans = pre[i];
        ++ans;
        cout << ans << endl;
    }

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

int main(void){

    int N = 0;
    scanf("%d", &N);
    N %= 10;

    if (N == 3){
        puts("bon");
    } else if (N == 0 || N == 1 || N == 6 || N == 8){
        puts("pon");
    } else {
        puts("hon");
    }

    return 0;
}
//  [c]
#include <stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	n=n%10;
	if(n==2||n==4||n==5||n==7||n==9) printf("hon");
	else if(n==3) printf("bon");
	else printf("pon");
	return 0;
}
//  [c]
#include<stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    int s = n % 10;
    if(s == 2 || s == 4 || s == 5 || s == 7 || s == 9)puts("hon");
    else if(s == 3)puts("bon");
    else puts("pon");
}
//  [c]
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
//    int a[5]={2,4,5,7,9};
//    int b[4]={0,1,6,8};
//    int c[1]={3};
    cin>>n;
    //cout<<n;
    vector<int>m;
    while(n>0){
        int k=n%10;
        m.push_back(k);
        n/=10;
        //cout<<n<<endl;
    }
    //cout<<n<<endl;
    //m.push_back(n);
    for(int i=0;i<m.size();i++){
        //cout<<m[i]<<" ";
        if(m[i]==3){
            cout<<"bon"<<endl;
            break;
        }
        else if(m[i]==0||m[i]==1||m[i]==6||m[i]==8){
            cout<<"pon"<<endl;
            break;
        } else {
            cout<<"hon"<<endl;
            break;
        }
    }
}
//  [c]
#include <stdio.h>

int a,num,c;

int main(){
	scanf("%d",&a);
    num = a/100;
    switch (num) {
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                printf("hon");
                break;
            case 0:
            case 1:
            case 6:
            case 8:
                printf("pon");
                break;
            case 3:
                printf("bon");
                break;
            default:
                printf("Out of range");
                break;
        }
	return 0;
}
//  [c]
#include<iostream>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int ans=N%10;
  if(ans=2||4||5||7||9)
  { 
    cout<<"hon"<<endl;
  }
  else if(ans=0||1||6||8)
  {
    cout<<"pon"<<endl;
  }
  else (ans==3)
  {
  cout<<"bon"<<endl;
}
  return 0;
}
//  [javascript]
const main = (input) => {
  const n = Number(input)
  const nOne = n % 10
  if (nOne === 2 || nOne === 4 || nOne === 5 || nOne === 7 || nOne === 9) {
    console.log('hon')
  } else if (nOne === 0 || nOne === 1 || nOne === 6 || nOne === 8) {
    console.log('pon')
  } else {
    console.log('bon')
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
function Main(input) {
    input = input.split("\n");
    tmp = input[0].split(" ");
    var a = parseInt(input[0].slice(-1), 10)

    if ([2,4,5,7,9].indexOf(a)>=0) {
    	console.log("hon")
    }else if([0,1,6,8].indexOf(a)>=0) {
    	console.log("pon")
    }else{
    	console.log("bon")
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.trim();
  var N = input;

  var Ns = N.split("");

  var saigo = Ns[Ns.length - 1];
  if (saigo == "3") {
    console.log("bon");
    return;
  } else if (saigo == "0" || saigo == "1" || saigo == "6" || saigo == "8") {
    console.log("pon");
    return;
  } else {
    console.log("hon");
    return;
  }
}

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

const main = (input) => {
    const spi = input.split('\n');
    const n = parseInt(spi[0]);
    n = (n % 100) % 10;

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

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// AUTHOR:: MOHAMAMD FAISAL

"use strict";

const main = (input) =>{
  
  //const arr = input.trim().split("");
//  const firstplace = arr[arr.length -1];
  const firstplace = input%10;
  
  if(firstplace ==3)
    console.log("bon");
  else if(firstplace==0 || firstplace==1 || firstplace==6 || firstplace==8)
    console.log("pon");
  else
    console.log("hon");
};
  
main(require("fs").readFileSync("dev/stdin","utf-8"));
//  [javascript]
// AUTHOR:: MOHAMAMD FAISAL

"use strict";

const main = (input) =>{
  
  const arr = input.trim().split("");
  const firstplace = arr[arr.length -1];
  
  if(firstplace ==3)
    console.log("bon");
  else if(firstplace==0 || firstplace==1 || firstplace==6 || firstplace==8)
    console.log("pon");
  else
    console.log("hon");
};
  
main(require("fs").readFileSync("dev/stdin","utf-8"));
//  [go]
package main

import "fmt"


func main() {
	var n int
	fmt.Scan(&n)
	firstPlaceNum := n % 10
	switch firstPlaceNum {
	case 2,4,5,7,9:
		fmt.Println("hon")
	case 0,1,6,8:
		fmt.Println("pon")
	case 3:
		fmt.Println("bon")
	}
}
//  [go]
package main

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

// go run ./ABC168/A\ -\ ∴\ \(Therefore\)/main.go < in

func main() {
	sc := bufio.NewScanner(os.Stdin)
	var inputLastStr string
	for i := 0; i <= 0; i++ {
		sc.Scan()
		inputs := strings.Split(sc.Text(), "")
		inputLastStr = inputs[len(inputs)-1]
	}
	input, _ := strconv.Atoi(inputLastStr)

	judge(input)
}

func judge(callTarget int) {
	if callTarget == 2 || callTarget == 4 || callTarget == 5 || callTarget == 7 || callTarget == 9 {
		fmt.Println("hon")
	} else if callTarget == 0 || callTarget == 1 || callTarget == 6 || callTarget == 8 {
		fmt.Println("pon")
	} else if callTarget == 3 {
		fmt.Println("bon")
	}
}
//  [go]
package main

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

var (
	input  = bufio.NewScanner(os.Stdin)
	tokens []string
)

// genTokens generates tokens from the input, and puts it into the tokens array.
func genTokens() {
	if !input.Scan() {
		panic("No more input")
	}

	nextFields := strings.Fields(input.Text())
	tokens = append(tokens, nextFields...)
}

// nextInt returns next int in its input, or panics if no input.
func nextInt() int {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	ret, err := strconv.Atoi(next)
	if err != nil {
		panic(err)
	}
	return ret
}

// nextInt64 returns next int in its input, or panics if no input.
func nextInt64() int64 {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	ret, err := strconv.ParseInt(next, 10, 64)
	if err != nil {
		panic(err)
	}
	return ret
}

// next returns the next string separated by spaces, or panics if no input.
func next() string {
	if len(tokens) == 0 {
		genTokens()
	}
	if len(tokens) == 0 {
		panic("No more input")
	}

	next := tokens[0]
	tokens = tokens[1:]

	return next
}

func main() {
	n := nextInt()
	switch n % 10 {
	case 2:
		fallthrough
	case 4:
		fallthrough
	case 5:
		fallthrough
	case 7:
		fallthrough
	case 9:
		fmt.Println("hon")
	case 0:
		fallthrough
	case 1:
		fallthrough
	case 6:
		fallthrough
	case 8:
		fmt.Println("pon")
	case 3:
		fmt.Println("bon")
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	a := 0
	fmt.Scanf("%d", a)
	a %= 10
	switch a {
	case 2, 4, 5, 7, 9:
		fmt.Println("hon")
	case 0, 1, 6, 8:
		fmt.Println("pon")
	default:
		fmt.Println("bon")
	}
}
//  [go]
package main

import "fmt"

func main() {
	var n int

	fmt.Scanf("%d", &n)

	hon_list := []int{2,4,5,7,9}

	pon_list := []int{0,1,6,8}

	if contains(hon_list, n)  {
		fmt.Printf("hon")
	} else if contains(pon_list, n) {
		fmt.Printf("pon")
	} else {
		fmt.Printf("bon")
	}
}

func contains(arr []int, i int) bool {
	for _, a := range arr {
		if a == i {
			return true
		}
	}
	return false
}
//  [go]
package main

import "fmt"


func main() {
	var n int
  	fmt.Scanf("%d", &n)
  	
  	sup := n%10
  
  if sup == 3 {
    fmt.Println("bon")
  }else if (sup ==2 || sup == 4 || sup == 5 || sup == 7 || sup == 8 || sup == 9 ) {
    fmt.Println("hon")
  }else {
    fmt.Println("pon")
  }
}
//  [ruby]
n = gets.chomp.to_i

amari = n % 10

if amari == 2  || amari == 4 || amari == 5 || amari == 7 ||  amari == 9
  print "hon\n"
elsif amari == 0 || amari == 1 || amari == 6 || amari == 8
  print "pon\n"
else
  print "bon\n"
end
//  [ruby]
N = gets.chomp[-1].to_i
case N
when 2,4,5,7,9
  puts 'hon'
when 0,1,6,8
  puts 'pon'
when 3
  puts 'bon'
end
//  [ruby]
case gets.chomp.split('').last.to_i
when 2, 4, 5, 7, 9
  puts 'hon'
when 0, 1, 6, 8
  puts 'pon'
when 3
  puts 'bon'
end
//  [ruby]
n = gets.chomp.to_i

if [2, 4, 5, 7, 9].include? n[-1]
  puts 'hon'
elsif [0, 1, 6, 8].include? n[-1]
  puts 'pon'
else
  puts 'bon'
end
//  [ruby]
n = gets.split('').map(&:to_i)
bon = [3]
pon = [0, 1, 6, 8]

if bon.include?(n[-1])
  puts 'bon'
elsif pon.include?(n[-1])
  puts 'pon'
else puts 'hon' 
end
//  [ruby]
s=gets.chomp
if [2,4,5,7,9].include? s[-1]
  puts 'hon'
elsif [0,1,6,8].include? s[-1]
  puts 'pon'
else
  puts 'bon'
end
//  [rust]
use proconio::input;

fn main() {
  input! {
    n: i32
  }

  println!("{}", match n % 10 {
    2 | 4 | 5 | 7 | 9 => "hon",
    0 | 1 | 6 | 8 => "pon",
    3 => "bon",
    _ => "_"
  });
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: u64,
    }
    let ans = match n % 10 {
        2 | 4 | 5 | 7 | 9 => "hon",
        0 | 1 | 6 | 8 => "pon",
        3 => "bon",
        _ => unreachable!(),
    };
    println!("{}", ans);
}
//  [rust]
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize
    }
    match n % 10 {
        2|4|5|7|9 => println!("hon"),
        0|1|6|8 => println!("pon"),
        _ => println!("bon"),
    }
}
//  [rust]
use proconio::input;

fn main() {
  
  let mut _n : usize ;
  let mut _d : String ;
 

  

    input! {
     
      mut n : usize ,
      mut d : String ,
    }

     let  length = d.len();

      if length > n{
        let s = &d[0..n];
      println!("{}...",s);

     }else   {

      println!("{}",d);

     }

   
    
}
//  [rust]
use proconio::input;

fn main() {
  
  let mut _n : usize ;
  let mut _d : String ;
 

  

    input! {
     
      mut n : usize ,
      mut d : String ,
    }

     let  length = d.len();
     let s = &d[0..n];

      if length > n{

      println!("{}... ",s);

     }else {

      println!(".. ");

     }
}
//  [rust]
use proconio::input;

fn main() {
    input! {
        n: i32
    }

    solve(n);
}

fn solve(n: i32) {
    match n % 10 {
        2 => println!("hon"),
        4 => println!("hon"),
        5 => println!("hon"),
        7 => println!("hon"),
        9 => println!("pon"),
        0 => println!("pon"),
        1 => println!("pon"),
        6 => println!("pon"),
        8 => println!("pon"),
        _ => println!("bon"),
    }
}
//  [swift]
let c = Int(readLine()!)!

switch c%10 {
case 2,4,5,7,9:
    print("hon")
 break
case 0,1,6,8:
    print("pon")
    break
case 3:
    print("bon")
    break
default:
    break
}
//  [swift]
let N = Int(readLine()!)!
let digit = N % 10
if digit == 2 || digit == 4 || digit == 5 || digit == 7 ||
  digit == 9 {
  print("hon")
} else if digit == 0 || digit == 1 || digit == 6 || digit == 8 {
  print("pon")
} else {
  print("bon")
}
//  [swift]
let value = Int(readLine()!)!
let pon = "pon"
let hon = "hon"
let bon = "bon"
let table = [pon, pon, hon, bon, hon, hon, pon, hon, pon, hon]

print(table[value % 10])
//  [swift]
import UIKit

var b = (Float(readLine()!)!).remainder(dividingBy: 10.0);

if(b == 2 || b == 4 || b == 5 || b == 7 || b == 9)
{
    print("hon")
}
else if(b == 0 || b == 1 || b == 6 || b == 8)
{
    print("pon")
}
else
{
    print("bon")
}
//  [swift]
import UIKit

var b = (Int(readLine()!)! % 10);
//  [swift]
import UIKit

var a = readLine()!;
var b = (Int(a)! % 10);

if(b == 2 || b == 4 || b == 5 || b == 7 || b == 9)
{
    print("hon")
}
else if(b == 0 || b == 1 || b == 6 || b == 8)
{
    print("pon")
}
else
{
    print("bon")
}
//  [typescript]
/**
 * https://atcoder.jp/contests/abc168/tasks/abc168_a
 * 
 * いろはちゃんは、人気の日本製ゲーム「ÅtCoder」で遊びたい猫のすぬけ君のために日本語を教えることにしました。
 * 日本語で鉛筆を数えるときには、助数詞として数の後ろに「本」がつきます。
 * この助数詞はどんな数につくかで異なる読み方をします。
 * 具体的には、999 以下の正の整数 N について、「N 本」と言うときの「本」の読みは
 * N の 1 の位が 2,4,5,7,9 のとき hon
 *・N の 1 の位が 0,1,6,8 のとき pon
 *・N の 1 の位が 3 のとき bonです。
 *・N が与えられるので、「N 本」と言うときの「本」の読みを出力してください。
 *
 * 制約
 * N は 999 以下の正の整数
 */
export function Main(input: string) {
  // 問題文解体エリア
  const num = Number(input).valueOf();

  // console.log(nums);
  // 問題解決エリア
  const answer = fuck(num);

  //出力エリア
  console.log(answer.toString());
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
// 提出する時にコメントアウト解除せよ
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

export function fuck(num:number): string {
  const hons = ["2", "4", "5", "7", "9"];
  const pons = ["0", "1", "6", "8"];
  const bons = ["3"];

  const numStr = num.toString();
  const numOn1 = numStr.substr(numStr.length - 1);
  if (hons.indexOf(numOn1) >= 0) {
    return "hon";
  } else if (pons.indexOf(numOn1) >= 0) {
    return "pon";
  } else if (bons.indexOf(numOn1) >= 0) {
    return "bon";
  }
  return "fuck";
}
//  [typescript]
import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);

(function main() {
  const N = readInt();
  let o;
  switch (N % 10) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      o = 'hon';
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      o = 'pon'
      break;
    case 3:
      o = 'bon';
      break;
  }
  console.log(o);
})();
//  [typescript]
import * as fs from 'fs'
import {debug} from '../../../util'

const input = fs.readFileSync('/dev/stdin', 'utf8').trim()

const output = (x: string | number | boolean) => console.log(x)
const splitLine = (string: string): string[] => string.split('\n')
const splitBlank = (string: string): string[] => string.split(' ')
const toNumbers = (array: string[]): number[] => array.map(v => Number(v))
const createSerialNumber = (n: number): number[] => [...Array(n).keys()]

// debug(input)

/* ここから */
const m = input.slice(-1)
if (m == '2' || m == '4' || m == '5' || m == '7' || m  == '9') {
    output('hon')
} else if (m == '3') {
    output('bon')
} else {
    output('pon')
}
//  [typescript]
import * as fs from 'fs';
 
const input = fs.readFileSync("/dev/stdin", "utf8").toString();

const fp = input[input.length - 1];
 
if(new Set(['2', '4', '5', '7', '9']).has(fp)) {
  console.log('hon');
}else if(new Set(['0', '1', '6', '8']).has(fp)) {
  console.log('pon');
} else {
  console.log('bon');
}
//  [typescript]
import * as fs from 'fs';

const input = String(fs.readFileSync("/dev/stdin", "utf8"));

const fp = input.slice(-1);

if(new Set(['2', '4', '5', '7', '9']).has(fp)) {
  console.log('hon');
}else if(new Set(['0', '1', '6', '8']).has(fp)) {
  console.log('pon');
} else {
  console.log('bon');
}
//  [typescript]
import * as fs from 'fs';

const input = String(fs.readFileSync("/dev/stdin", "utf8"));

const fp = input.slice(-1);

if(['2','4','5','7','9'].includes(fp)) {
  console.log('hon');
}else if(['0','6','1','8'].includes(fp)) {
  console.log('pon');
} else {
  console.log('bon');
}
//  [python]
N = int(input())
X = list(map(int, input().split()))


def variance(x):
    avg = sum(X) // len(X)
    return (avg - x) ** 2


def main(X):
    tot = 0
    tot2 = 0
    for x in X:
        tot += variance(x)
        tot2 += variance(x - 1)
    return min(tot, tot2)


ans = main(X)
print(ans)
//  [python]
n=int(input())
x=list(map(int,input().split()))
sum=0
for i in x:
  sum+=i
t=round(sum/n)
sum=0
for i in x:
  sum+=(t-i)**2
print(sum)
//  [python]
N = int(input())
X_list = list(map(int, input().split()))

P = round(sum(X_list) / N)
ans = 0
for i in range(N):
    ans += (X_list[i] - P) ** 2
print(ans)
//  [python]
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7
import math
import statistics
n = I()
xl = LI()

# n人が消費する体力の総和の最小値
# 数直線上にn人が住んでいる
# i番目がXi
# n人全員が参加する集会
# 任意の整数値の座標で集会を開く。座標pで集会を開くときはi番目の人は(Xi-p))**2の体力を消費する。

xl_mean = math.ceil(statistics.mean(xl))

sigma_pow = sum([(x-xl_mean)**2 for x in xl])

print(sigma_pow)
//  [python]
N=int(input())
X=list(map(int,input().split()))
X.sort()

ans=10**1000
for p in range(X[0],X[-1]):
    tmp=0
    for x in X:
        tmp+=(x-p)**2
    ans=min(ans,tmp)
print(ans)
//  [python]
N=int(input())
X=list(map(int,input().split()))
X.sort()

ans=10**10
for p in range(X[0],X[-1]):
    tmp=0
    for x in X:
        tmp+=(x-p)**2
    ans=min(ans,tmp)
print(ans)
//  [java]
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class  Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        String[] l = reader.readLine().split(" ");
        int s = 0;
        int sumsq = 0;
        for(String t:l){
            int y = Integer.parseInt(t);
            s=s+y;
            sumsq+=y*y;
        }
        int p =  (s/N);
        System.out.println(Math.min((N*p*p-2*p*s+sumsq),(N*(p+1)*(p+1) - 2*(p+1)*s+sumsq)));

    }
}
//  [java]
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        for(int i = 0; i < n; i++) x[i] = scan.nextInt();
        int out = Integer.MAX_VALUE;
        for(int i = 1; i <= 100; i++){
            int c = 0;
            for(int j = 0; j < n; j++){
                c += (x[j] - i) * (x[i] - j);
            }
            out = Math.min(out, c);
        }
        System.out.println(out);
    }

    public static void main(String[] args){
        new Main().solve();
    }
}
//  [java]
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    public static MyScanner scan;
    public static PrintWriter out;
    public static void main(String[] args) {
        scan=new MyScanner();
        out=new PrintWriter(new BufferedOutputStream(System.out));

        int t=1;
//        int t=scan.nextInt();
        while(t-->0) {

            n=scan.nextInt();
            a=new int[n];
            for(int c=0;c<n;c++) a[c]=scan.nextInt();
            long best=Long.MAX_VALUE;
            for(int c=a[0];c<a[n-1];c++) best=Math.min(best,calc(c));
            out.println(best);
        }
        out.close();
    }

    static int n;
    static int[] a;
    static long calc(int spot) {
        long ans=0;
        for(int c=0;c<n;c++) ans+=(spot-a[c])*(spot-a[c]);
        return ans;
    }

    //scanner
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}
//  [java]
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    public static MyScanner scan;
    public static PrintWriter out;
    public static void main(String[] args) {
        scan=new MyScanner();
        out=new PrintWriter(new BufferedOutputStream(System.out));

        int t=1;
//        int t=scan.nextInt();
        while(t-->0) {

            n=scan.nextInt();
            a=new int[n];
            for(int c=0;c<n;c++) a[c]=scan.nextInt();
            long best=Long.MAX_VALUE;
            for(int c=a[0];c<a[n-1];c++) best=Math.min(best,calc(c));
            out.println(best);
        }
        out.close();
    }

    static int n;
    static int[] a;
    static long calc(int spot) {
        long ans=0;
        for(int c=0;c<n;c++) ans+=Math.pow(Math.abs(spot-a[c]),2);
        return ans;
    }

    //scanner
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}
//  [cpp]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i=0;i<n;i++){
    scanf("%d", &a[i]);
  }
  int S = 0;
  for (int i=0;i<n;i++){
    S += a[i];
  }
  int p;
  if (S % n <= n / 2){
    p = S / n;
  }
  else{
    p = S / n + 1;
  }
  int X = 0;
  for (int i=0;i<n;i++){
    X += (a[i] - p) * (a[i] - p);
  }
  printf("%d\n", X);
  return 0;
}
//  [cpp]
#include "algorithm"
#include "cmath"
#include "iomanip"
#include "iostream"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;

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

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
void drop(const T& x) {
  cout << x << endl;
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;
  V<ll> xs(N);
  rep(i, N) cin >> xs[i];

  ll ret = 1e18;

  rep1(x, 100) {
    ll sum = 0;

    rep(i, N) { sum += pow(xs[i] - x, 2); }

    chmin(ret, sum);
  }

  cout << ret << endl;

  return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main()
{
   int n,x;
   double sum=0;
   cin>>n;
   int arr[n];
   for(int i=0;i<n;i++)
   {
       cin>>arr[i];
       sum+=arr[i];
   }
   int avg=sum/n;
  // cout<<avg;
   double avvg=sum/n;
   //cout<<avvg<<endl;
   double dif=avvg-avg;
   if(dif>0.5)
   {
       avvg=ceil(sum/n);
   }
   else
   {
       avvg=floor(sum/n);

   }
   int ans=0;
   for(int i=0;i<n;i++)
   {
       ans=ans+((arr[i]-avvg)*(arr[i]-avvg));
   }
   cout<<ans;

    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
/*bool is(long long a){
    if(a==2) return true;
    if(a<=1||a%2==0) return false;
    for(int i=3;i*i<=a;i+=2){
        if(a%i==0) return false;
    }
    return true;
}*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout.setf(ios_base::fixed,ios_base::floatfield);
    int n,z=0,g=100000009;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int j=1;j<=100;j++){
        for(int i=0;i<n;i++){
            if(a[i]==j){
                z=100000009;
                break;
            }
            z+=abs(a[i]-j)*abs(a[i]-j);
        }
        g=min(g,z);
        z=0;
    }
    cout<<g<<'\n';
}
//  [cpp]
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,x[105],ans=100000;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int i=1;i<=100;i++){
        int sum=0;
        for(int j=0;j<n;j++){
            sum+=abs(i-x[j])*abs(i-x[j]);
        }
        if(ans>sum){
            ans=sum;
        }
    }
    cout<<ans<<endl;
    return(0);
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define F first
#define S second
#define inf (long long) 1e18
#define f(i,n)  for(int i=0;i<n;i++)
#define f(i,n) for(int i=n-1;i>=0;i--)
#define f(i,n) for(int i=1;i<=n;i++)

const int MOD = 1e9 + 7;

void solve()
{
    int n;
    cin >> n;
    int arr[n];
    int s=0,c=0;
    for(int i=0;i<n;i++)
    {
        cin >> arr[i];
        s+=arr[i];
    }
    int avg=s/n;
    for(int i=0;i<n;i++)
    {
        int k=avg+1-arr[i];
        c+=k*k;
    }
    int c1=0;
    for(int i=0;i<n;i++)
    {
        int k=avg+1-arr[i];
        c1+=k*k;
    }
    cout << min(c,c1);
}


int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t=1;
  //cin>>t;
  while(t--)
  {
      solve();
  }
}
//  [c]
#include <stdio.h>
int main()
{
    int n,i,sum=0,a=0,b=0,count1=0,count2=0;
    scanf("%d",&n);
    int x[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&x[i]);
        sum+=x[i];
    }
    a=sum/n;
    b=sum/n+1;
    for(i=0;i<n;i++)
    {
        count1+=(x[i]-a)*(x[i]-a);
        count2+=(x[i]-b)*(x[i]-b);
    }
    if(count1<=count2)
    {
        printf("%d",count1);
    }
    else
    {
       printf("%d",count2);
    }
    return 0;
}
//  [c]
#include <stdio.h>

int main(void){
   
   int a[100], n, i, p;
   long r, res,result = 0, min = 300000000;
   
   scanf("%d\n", &n);

   for(i = 0; i <= n-1 ; i++){
       scanf("%d", &a[i]);
   }
   
   for(p = 0; p<101 ;p++){
       i = 0;
       result = 0;
       for(; i<=n-1; i++){
          r = a[i] - p;
          res = r * r;
          result += res;
       }
       if(min > result){
           min = result;
       }
   }

   printf("%ld\n", min);

   
   return 0;
}
//  [c]
#include<stdio.h>
int main(void){
    int i,n,x[101],max=0,avr1,avr2,hp1=0,hp2=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x[i]);
    }

    for(i=0;i<n;i++){
        max+=x[i];
    }
    avr1=max/n;
    avr2=avr1+1;

    for(i=0;i<n;i++){
        hp1+=(x[i]-avr1)*(x[i]-avr1);
    }
    for(i=0;i<n;i++){
        hp2+=(x[i]-avr2)*(x[i]-avr2);
    }
    if(hp1<hp2){
        printf("%d",hp1);
    }else{
        printf("%d",hp2);
    }
    
    return 0;    
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void){

  int N;
  int X[101];
  scanf("%d",&N);
  
  int i;
  for(i=0;i<N;i++){
    scanf("%d",&X[i]);
  }
  
  int ans = 100*100*100;
  int p;
  for(p=1;p<=100;p++){
    int sum;
    for(i=0;i<N;i++){
    sum = sum + pow(X[i]-p,2);
    }
    if(ans>sum) ans = sum;
  }
  
  printf("%d",ans);
  
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void){

  int N, i=0, a=10000, sum=0;
  int X[101];
  
  scanf("%d",&N);
  scanf("%d",&X);
  
  while(i=!NULL){
    sum = sum + pow((X[101]-X[i]),2);
    i++;
    if(a>sum) a=sum;
  }
  return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>
const int inf = 1000000000;
int main(void){
  int n;
  char x[105];
  
  scanf("%d", &n);
  for(int i=0;i<n;i++){
    scanf("%d",&x[i]);   
  }
    int l=x[0];
  int r=x[0];

  for(int i=0;i<n;i++){
    if(l>x){
      l=x[i];
    }
    if(r<x){
      r=x[i];
    }

  }

  int ans = inf;
  for(int i=l;i<=r;i++){
     int cost = 0;

    for(int j=0;j<n;j++) {
      cost +=(x[j]-i)*(x[j]-i);
    }
    if(ans>cost){
      ans = cost;
      //ans = MIN(ans,cost);
    }
    
  }

  
  printf("%d\n", ans);
  return 0;
}
//  [javascript]
'use strict'
const main = arg => {
  const n = parseInt(arg.split('\n')[0], 10)
  const xn = arg
    .split('\n')[1]
    .split(' ')
    .map(e => parseInt(e, 10))
  const avg = Math.round(xn.reduce((val, e) => val + e, 0) / n)
  const w = xn.reduce((v, e) => v + (e - avg) * (e - avg), 0)
  console.log(w)
}
main(require('fs').readFileSync('/dev/stdin', 'utf-8'))
//  [javascript]
function main(input) {
    var N = input[0].split(" ")[0]-0;
    var list = input[1].split(" ").map(v=>v-0);
    var ans = Number.MAX_SAFE_INTEGER;
    for(var p=0;p<=100;p++){
        var sum = 0;
        for(var i=0;i<N;i++){
            sum += (list[i]-p)*(list[i]-p);
        }
        ans = Math.min(ans,sum);
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
"use strict";
function Main(input) {
  input = input.split("\n");
  let n = Number(input[0]);
  let place_array = input[1].split(" ").map(Number);
  let min = 0;
  for (let cp = 0; cp < 100; cp++) {
    let tmp_total = 0;
    for (let i = 0; i < n; i++) {
      tmp_total += Math.pow((cp - place_array[i]), 2);
      //console.log(`${point} - ${place_array[index]}の2乗 = ${(point - place_array[index]) ** 2}`);
    }
    if (cp === 0) min = tmp_total;
    min = min < tmp_total ? min : tmp_total;
  }
  console.log(min);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = arr[1].split(' ').map(x => Number(x));
  let sum = 0;

  for (let i = 0; i < a.length; i ++) {
    sum += ((arr[0] - a[i]) * (arr[0] - a[i]));
  }
  
  console.log(sum);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = arr[1].split(' ').map(x => Number(x));
  let sum = 0;

  for (let i = 0; i < a.length; i ++) {
    sum += (arr[0] - a[i]) ** 2;
  }
  
  console.log(sum);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}

function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = myconv(next(),4);
  var N = one[0];
  var M = one[1];
  if(M == 0){
     /*if(N == 1){*/
        myout(0);
     /*}else{
        myout(-1);
     }*/
    return;
  }
  var list = new Array(N);
  while(hasNext()){
    var tmp = myconv(next(),4);
    if(N != 1 && tmp[0] == 1 && tmp[1] == 0){
       continue;
    }
    if(list[tmp[0] - 1] == null){
       list[tmp[0] - 1] = tmp[1];
    }else{
       list[tmp[0] - 1] = Math.min(list[tmp[0] - 1],tmp[1]);
    }
  }
  myerr(list);
  if(N != 1 && (list[0] == 0 || list[0] == null)){
     myout(-1);
    return;
  }else{
    if(N == 1 && list[0] == null){
       list[0] = 0;
    }
    if(N >= 2 && list[1] == null){
       list[1] = 0;
    }
    if(N == 3 && list[2] == null){
       list[2] = 0;
    }
  }
  
  myout(myconv(list,0));
}
Main();
//  [go]
package main

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

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	var N int
	if scanner.Scan() {
		N, _ = strconv.Atoi(scanner.Text())
	}
	A := make([]int, N)
	var sum int
	for i := 0; i < N; i++ {
		if scanner.Scan() {
			A[i], _ = strconv.Atoi(scanner.Text())
			sum += A[i]
		}
	}
	x := sum / N

	var ans1 int
	for _, v := range A {
		ans1 += (v - x) * (v - x)
	}
	var ans2 int
	x++
	for _, v := range A {
		ans2 += (v - x) * (v - x)
	}
	var ans int
	if ans1 < ans2 {
		ans = ans1
	} else {
		ans = ans2
	}

	var wtr = bufio.NewWriter(os.Stdout)
	fmt.Fprintln(wtr, ans)
	_ = wtr.Flush()
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	x := make([]int, n)
	for i, _ := range x {
		fmt.Scan(&x[i])
	}

	ans := 1000000000000
	for i := 1; i <= 100; i++ {
		temp := 0
		for _, v := range x {
			temp += (i - v) * (i - v)
		}
		ans = min(temp, ans)
	}
	fmt.Println(ans)

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

import "fmt"

func main() {
  var N int
  fmt.Scan(&N)
  A := make([]int, N)
  
  for i:=range A {
    fmt.Scan(&A[i])
  }
  
  ans := 0
  for i:=1; i<=100; i++ {
    totalLoss := 0
    for j:= range A {
      totalLoss += (A[j]-i)*(A[j]-i)
    }
    if i==1 {
      ans = totalLoss
    }
    if totalLoss < ans {
      ans = totalLoss
    }
  }
  fmt.Println(ans)
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func contains(target string, list []string) bool {
	for _, r := range list {
		if target == r {
			return true
		}
	}
	return false
}

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

func nextInt() int {
	sc.Scan()

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

func nextF64() float64 {
	sc.Scan()

	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func isInteger(x float64) bool {
	return math.Floor(x) == x
}

func Ave(s []int) int {
	val := 0
	for _, i := range s {
		val += i
	}
	return int(val / len(s))
}
func cal(i int) (sum int) {
	for i != 0 {
		sum += i % 10
		i /= 10
	}
	return
}
func max(a []int) (idx int, val int) {
	max := a[0]
	idx = 0
	for j, i := range a {
		if max < i {
			max = i
			idx = j
		}
	}
	return idx, max
}

func draw(i int, a []int) (l []int) {
	// p = a[i]
	for j := i; j < len(a); j++ {
		if j != len(a)-1 {
			a[j] = a[j+1]
		} else if j == len(a)-1 {
			a = a[:len(a)-1]
		}
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	var x []int
	var wa int
	out := 10000

	for i := 0; i < n; i++ {
		x = append(x, nextInt())
	}

	sort.Ints(x)

	for i := x[0]; i <= x[len(x)-1]; i++ {
		wa = 0
		for _, j := range x {
			wa += int(math.Pow(float64(j-i), 2))
		}
		if out > wa {
			out = wa
		}
	}
	fmt.Println(out)

}
//  [go]
package main

import (
	"fmt"
	"sort"
)

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

	sort.Ints(nums)
	for i := 0; i < n; i++ {
		result += (nums[i] - n) * (nums[i] - n)
	}
	fmt.Println(result)
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, result, distance int
	fmt.Scan(&n)
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&nums[i])
	}

	sort.Ints(nums)
	for i := 0; i < n; i++ {
		result += (nums[i] - nums[0]) * (nums[i] - nums[0])
	}
	
}
//  [ruby]
N = gets.to_i
peoples = gets.split.map(&:to_i)
sum_minus, sum, sum_plus = 0, 0, 0
mid = (peoples.inject(:+) / peoples.length)
#mid = (peoples.max + peoples.min) / 2
mid_minus = mid - 1
mid_plus = mid + 1

peoples.each { |p|
  sum_plus += (p - mid_plus) ** 2
  sum_minus += (p - mid_minus) ** 2
  sum += (p - mid) ** 2
}

puts [sum_plus, sum,sum_minus].min
//  [ruby]
attrs = Array.new
while line = $stdin.gets
  attrs << line.chomp.split
end

N = attrs[0][0]
X = attrs[1].map{|a| a.to_i}
total = X.inject(:+)
p = (total/N.to_f).round
res = 0
X.each do |x|
  res += (x-p)**2
end
puts res
//  [ruby]
n=gets.to_i
a=gets.split.map(&:to_i).sort
c=(a.inject(:+).to_f/n).round
s=a[0]
m=a[-1]
x=1000000
y=1000000
c.upto(m){|i|w=a.map{|j|(i-j)**2}.inject(:+)
  if x>w
    x=w
  else
    break
  end
  }
c.downto(s){|i|w=a.map{|j|(i-j)**2}.inject(:+)
  if y>w
    y=w
  else
    break
  end
  }
puts [x,y].min
//  [ruby]
N = gets.to_i
x = gets.split.map(&:to_i).sort
min = x[0]
max = x[N-1]

minimum = x[N-1]**2
(min..max).each do |i|
  sum = 0
  x.each{ |e| sum += (e - i)**2 }
  minimum = sum if sum < minimum
end

puts minimum
//  [ruby]
n=gets.to_i
s=gets.split.map!(&:to_i)
ans=0
max=s.sum
hei=(max/n).to_i
for i in 0..n-1
  ans+=(s[i]-hei)**2
end
puts ans
//  [ruby]
n=gets.to_i
s=gets.split.map!(&:to_i)
ans=0
max=s.sum
hei=((max/n)+1).to_i
for i in 0..n-1
  ans+=(s[i]-hei)**2
end
puts ans
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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 adjacent4(x: usize, y: usize, sx: usize, sy: usize) -> Vec<(usize, usize)> {
    [(-1, 0), (1, 0), (0, -1), (0, 1)]
        .into_iter()
        .filter_map(|&(dx, dy)| {
            let nx = x as isize + dx;
            let ny = y as isize + dy;
            if nx >= 0 && nx < sx as isize && ny >= 0 && ny < sy as isize {
                Some((nx as usize, ny as usize))
            } else {
                None
            }
        })
        .collect()
}

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
fn main() {
    input! {
        n: usize,
        x: [usize; n],
    }
    let p: usize = (x.iter().sum::<usize>() + (n / 2)) / n;
    let ans: usize = x.iter().map(|i| (i - p).pow(2)).sum();
    println!("{}", ans);
}