jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):string|string[]=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):string|string[]=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let a = t.n()-t.n();
  t.o(a<0?0:a)
}
main()
//  [typescript]
"use strict";

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

function main(input) {
  const [x, t] = input.split(" ").map(Number);

  const ans = x - t <= 0 ? 0 : x - t;
  console.log(ans);
}
//  [typescript]
const X = Number(process.argv[2]);
const t = Number(process.argv[3]);

// console.log(X);
// console.log(t);

console.log(X > t ? X - t : 0);
//  [python]
N,A,B = map(int,input().split())
if A == 0 or B == 0:
    print("0 0")
elif N >= A + B:
    a = min(A,B)
    print("{} {}".format(a,0))
else:
    a = min(A,B)
    b = A + B - N
    print("{} {}".format(a,b))
//  [python]
n,a,b = (int(i) for i in input().split())
x=min(a,b)
y=a+b-n
if y < 0:
    y=0
print(x,y)
//  [python]
N,A,B=[int(i) for i in input().split(" ")]
maximum=min(A,B)
minimum=max(A+B-N,0)
print(maximum,minimum)
//  [python]
n,a,b = map(int, input().split())
print(min(a,b),a+b-n)
//  [python]
n,a,b = map(int, input().split())


q=min(a, b)
w=a+b-n

print(q,w)
//  [python]
n, a, b = map(int, input().split())
if n >= a+b:
    print(min(a, b), 0)
else:
    if a == b:
        print(a, b)
    else:
        print(min(a, b), abs(a-b))
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.print(Math.min(a, b)+" ");
		if(a+b > n)
			System.out.print((a+b)-n+" ");
		if(a+b <= n)
			System.out.print(0+" ");
		
		out.flush();

	}


}

class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

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

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

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}

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

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();

    System.out.print(Math.min(a, b) + " ");

    if ((a + b) >= n) {
      System.out.println(Math.abs(a - b));
    } else {
      System.out.println(0);
    }

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

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();

    System.out.print(Math.abs(a - b) + " ");

    if ((a + b) >= n) {
      System.out.println(Math.min(a, b));
    } else {
      System.out.println(0);
    }

  }
}
//  [cpp]
#include <stdio.h>

int main(void){
  int n,a,b;
  scanf("%d%d%d",&n,&a,&b);
  int max,min;
  if(a>b)max = b;
  else max  = a;
  if(a > b){
    min = a;
  }else{
    min = b;
  }
  if(a+b> n){
    min = a+b-n;
  }else{
    min = 0;
  }
  printf("%d %d",max,min);
}
//  [cpp]
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
namespace io{
    #define ll long long
    #define inf 0x3f3f3f3f
    #define il inline 
    #define in1(a) read(a)
    #define in2(a,b) in1(a),in1(b)
    #define in3(a,b,c) in2(a,b),in1(c)
    #define in4(a,b,c,d) in2(a,b),in2(c,d)
    il void readl(ll &x){
        x=0;ll f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
    il void read(int &x){
        x=0;int f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
}
using namespace io;
int main(){
	int n,a,b;
	in3(n,a,b);
	printf("%d %d",min(a,b),max(a+b-n,0));
	return 0;
}
//  [cpp]
#include <stdio.h>

int main(int argc, char const *argv[]) {
	int X, A, B;
	scanf("%d %d %d", &X, &A, &B);

	int min = A < B ? A : B;
	int max = A > B ? A : B;
	printf("%d %d\n", min, max-(X-min) < 0 ? 0 : (max-(X-min)));

	return 0;
}
//  [cpp]
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int N, A, B;
	cin >> N >> A >> B;

	if (N >= A + B) {
		cout << min(A, B) <<" "<< 0 << endl;
	}
	else {
		cout << min(A, B) << " " << max(A, B) - min(A, B) << endl;
	}
}
//  [cpp]
    #include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
    #include<numeric>
    #include<array>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
    #define Vl vector<ll>
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<ll>>;
    using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;
const ll ZER = 0;

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ma = min(a, b), mi = min(0, a + b - n);
    cout << ma << " "  << mi << endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cout << min(a,b) << " " << max(0,a+b-n) << endl;
}
//  [c]
#include <stdio.h>
 
int main (void)
{
 int N,a,b;
 
scanf("%d",&N);
scanf("%d",&a);
scanf("%d",&b);
 
printf("%d",(a<b?a:b));
 
if(N>(a+b))
printf("  0");
else
printf("  %d",(a+b)-N);
 
return 0;
}
//  [c]
#include <stdio.h>
int min(int x, int y) {
	return x < y ? x : y;
}
int max(int x, int y) {
	return x > y ? x : y;
}
int main() {
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	printf("%d %d\n", min(a, b), max(a + b - n, 0));
	return 0;
}
//  [c]
#include <stdio.h>

int main(void){

  int n,a,b;
  scanf("%d %d %d", &n, &a, &b);
  int max,min;
  max = a;
  if (b < max) {
    max = b;
  }
  min = 0;
  if (a+b > n) {
    min = a+b-n;
  }
  printf("%d %d\n", max, min);

  return 0;
}
//  [c]
#include <stdio.h>
 
int main (void)
{
 int N,a,b;
 
scanf("%d",&N);
scanf("%d",&a);
scanf("%d",&b);
 
printf("%d",(a<b?a:b));
 
if(N<(a+b))
printf("  0");
else
printf("  %d",(a+b)-N);
 
return 0;
}
//  [c]
#include <stdio.h>
 
int main (void)
{
 int N,a,b;
 
scanf("%d",&N);
scanf("%d",&a);
scanf("%d",&b);
 
printf("%d",(a<b?a;b));
 
if(N<(a+b))
printf("  0");
else
printf("  %d",(a+b)-N);
 
return 0;
}
//  [c]
#include <stdio.h>
 
int main (void)
{
 int N,a,b;
 
scanf("%d",&N);
scanf("%d",&a);
scanf("%d",&b);
 
pirntf("%d",(a<b?a;b));
 
if(N<(a+b))
printf("  0");
eise
printf("  %d",(a+b)-N);
 
return 0;
}
#include <stdio.h>

int main (void)
{
 int N,a,b;

scanf("%d",&N);
scanf("%d",&a);
scanf("%d",&b);

printf("%d",(a<b?a;b));

if(N<(a+b))
printf("  0");
else
printf("  %d",(a+b)-N);

return 0;
}
//  [javascript]
function Main(input) {
	input = input.split(" ").map(Number);
	var n = -input[0]+input[1]+input[2];
	if(n<=0) n=0;
	console.log(Math.min(input[1],input[2])+" "+n);

}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
function Main(input) {
	input = input.trim().split(" ").map((list)=>Number(list));
  var output = Math.min(input[1],input[2]) + " ";//両方読んでいる最大
  if(input[0] < input[1] + input[2]){
    if(input[0] == Math.max(input[1],input[2])){ 
    	output += Math.min(input[1],input[2]);
    }else{
      output += input[1] + input[2] - input[0];
    }
     }else{
     output += "0";
     }
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");

	var n = parseInt(tmp[0], 10);
	var x = parseInt(tmp[1], 10);
	var y = parseInt(tmp[2], 10);
	var max = Math.min(x, y);
	var min = (x + y) -n;
	if(min < 0) {
		min = 0;
	}
	//出力
	console.log('%d %d',max,min);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
	// n is the first element
	var splitInput = input.split("\n");
	var n = parseInt(splitInput[0])
	
	// plate array is [ aHappiness, bHappiness, sumABHappiness ] sorted by sumABHappiness
	var plateArray = splitInput.slice(1).map(function(e){
		var splitab = e.split(" ")
		return [parseInt(splitab[0]),parseInt(splitab[1]),parseInt(splitab[0])+parseInt(splitab[1])]
	}).sort(function(x,y) {
		if (x[2] > y[2]) {
			return (-1) // desc order
		}
		if (x[2] < y[2]) {
			return 1 // desc order
		}
		  return 0;
	})
	
	//console.log(plateArray)
	
	var aHappiness = 0
	var bHappiness = 0
	
	for (var i=0; i<n; i++){
		if (i%2 == 0) {
			//console.log('a take %d happiness', plateArray[i][i%2])
			aHappiness += plateArray[i][i%2]
		} else {
			//console.log('b take %d happiness', plateArray[i][i%2])
			bHappiness += plateArray[i][i%2]
		}
	}
	
	//output
	return aHappiness-bHappiness
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
console.log("2\n4\n2\n0\n2\n6\n2")
//  [javascript]
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
	var splitInput = input.split("\n");
	var n = (splitInput[0])
	var plateArray = splitInput.slice(1).map(function(e){
		var splitab = e.split(" ")
		return [parseInt(splitab[0]),parseInt(splitab[1]),parseInt(splitab[0])+parseInt(splitab[1])]
	}).sort(function(x,y) {
		if (x[2] < y[2]) {
			return -1;
		}
		if (x[2] > y[2]) {
			return 1;
		}
		  return 0;
	})
	
	var aresult = 0
	var bresult = 0
	
	for (var i=0; i<n; i++){
		/*var j = 0
		var j0 = 0
		while (i+j < n && plateArray[i+j][2] == plateArray[i][2]){
			if (plateArray[i+j][i%2] > plateArray[i+j0][i%2]){
				j0 = j
			}
			j++
		}
		if (j0 != 0) {
			var tmp = plateArray[i].slice(0)
			plateArray[i] = plateArray[i+j0].slice(0)
			plateArray[i+j0] = tmp
		}*/
		if (i%2 == 0) {
			//console.log('a take %d', plateArray[i][i%2])
			aresult += plateArray[i][i%2]
		} else {
			//console.log('b take %d', plateArray[i][i%2])
			bresult += plateArray[i][i%2]
		}
	}
	
	//output
	console.log('%d',aresult-bresult);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	a := getNextInt(scanner)
	b := getNextInt(scanner)
	fmt.Fprintln(writer, fmt.Sprintf("%d %d", minint(a, b), maxint(a+b-n, 0)))
}

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

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	n, a, b := nextInt(), nextInt(), nextInt()
	ans1 := min(a, b)
	ans2 := max(a+b-n, 0)
	fmt.Println(ans1, ans2)
}
//  [go]
package main

import "fmt"

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

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

	fmt.Println(min(a, b), max(0, a-(n-b)))
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	n, a, b := nextInt(), nextInt(), nextInt()
	ans1 := min(a, b)
	ans2 := max(n-a-b, 0)
	fmt.Println(ans1, ans2)
}
//  [go]
package main

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

type Point struct {
	a int
	b int
}

type Points []Point

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

	dishes = make(Points, n)
	sc := bufio.NewScanner(os.Stdin)
	for i:=0; i<n; i++ {
		d := Point{}
		sc.Scan()
		fmt.Sscanf(sc.Text(), "%d %d", &d.a, &d.b)
		dishes[i] = d
	}

	sort.Sort(dishes)

	ans := 0
	for i:=0; i<n; i++ {
		if i%2 == 0 {
			ans += dishes[i].a
		} else {
			ans -= dishes[i].b
		}

	fmt.Println(ans)
}

// Sortアルゴリズムを使用するためにインタフェースの実装
func (r Points) Len() int {
	return len(r)
}
func (r Points) Swap(i, j int) {
	r[i], r[j] = r[j], r[i]
}
func (r Points) Less(i, j int) bool {
	return r[i].a+r[i].b > r[j].a+r[j].b
}
//  [go]
// https://nikkei2019-qual.contest.atcoder.jp/assignments
// +build ignore

package main

import (
	"fmt"
)

func main() {
	var a, b, n, xy_max, xy_min, greater_num, smaller_num int
	fmt.Scanf("%d %d %d\n", &n, &a, &b)
	if a <= b {
		xy_max = a
		smaller_num = a
		greater_num = b
	}else{
		xy_max = b
		smaller_num = b
		greater_num = a
	}
	if a + b <= n {
		xy_min = 0
	}else{
		xy_min = greater_num - smaller_num
	}
	fmt.Printf("%d %d\n", xy_max, xy_min)
}
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N,A,B=get_i
puts "#{min(A,B)} #{max(A+B-N,0)}"
//  [ruby]
n, a, b = gets.chomp.split.map(&:to_i)
puts "%d %d" % [[a, b].min, [a + b - n, 0].max]
//  [ruby]
n,a,b=gets.split.map &:to_i
printf "%d %d\n",[a,b].min,[a+b-n,0].max
//  [ruby]
n, a, b = gets.split().map(&:to_i)
 
sum = a + b
max, min = [0, 0]

if n <= sum
  max = n
  min = sum - n
else
  max = sum
  min = 0
end
 
puts [max, min]
//  [ruby]
n, a, b = gets.split().map(&:to_i)

sum = a + b
max = n < sum ? n : sum
min = a < b ? a : b

puts [max, min]
//  [ruby]
n,a,b=gets.split.map &:to_i
puts "#{[a,b].min} #{[a,b].max-n+[a,b].min}"
//  [rust]
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = 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")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:i32 = read();
    let a:i32 = read();
    let b:i32 = read();

    println!("{} {}", min(a,b), max(0,a+b-n));
}
//  [rust]
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::cmp::{max, min, Ordering};

macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

// N M => let (N, M) = get!(usize, usize)
// A1 B1
// ...
// AQ BQ => let A = get!(usize, usize; Q)

const MOD: u64 = 1000000007;

fn main() {
    let (N, X, Y) = get!(i32, i32, i32);

    println!("{} {}", min(X, Y), max(0, X + Y - N));
}
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, A, B): (i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = format!("{} {}", std::cmp::min(A, B), std::cmp::max(0, A + B - N));

    println!("{}", ans);
}
//  [rust]
fn main() {
    proconio::input! {
    a:[isize;3],
    }
    println!("{} {}",min(a[1],a[2]),max(a[1]+a[2]-a[0],0))
}
//  [rust]
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: usize = itr.next().unwrap().parse().unwrap();
    let b: usize = itr.next().unwrap().parse().unwrap();
    println!("{} {}", min(a, b), (a + b).saturating_sub(n));
}
//  [rust]
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let mut io = IO::new(stdin(), stdout(), stderr());
    // ===================================== //
        let v = io.readn::<isize>(3);
        let mn = min(v[0],v[1]);
        let mx = max(0, -v[0]+v[1]+v[2]);
        println!("{} {}",mn,mx);
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
}
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!},N=i[0],A=i[1],B=i[2]
print(min(A,B), max(A+B-N,0))
//  [swift]
let Nstr: String? = readLine()
let N: Int = Int(Nstr!)!
let Astr: String? = readLine()
let A: Int = Int(Nstr!)!
let Bstr: String? = readLine()
let B: Int = Int(Nstr!)!

let mini = A < B ? A : B
print(mini, A + B - N < 0 ? 0 : A + B - N)
//  [swift]
using System;
class Program
{
	static void Main(string[] args)
	{
        string[] input = Console.ReadLine().Split(' ');
        int n = input[0];
        int x = input[1];
        int y = input[2];
        
        int max, min;
        if (n - x + y > 0) {
            min = n - x + y;
        } else { min = 0; }
        if (x > y){
            max = y;
        }else{
            max = x;
        }

		Console.WriteLine(max + " " + min);
	}
}
//  [typescript]
function main(input) {
  const args = input.split(" ");
  const N = parseInt(args[0]);  
  const A = parseInt(args[1]);  
  const B = parseInt(args[2]);  
  const max = Math.min(A, B);
  const min = Math.max(0, ((A+B) - N));
  console.log(`${max} ${min}`)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input) {
    const nums = input.split(/\s/).map(str => { return parseInt(str) });
    console.log(Math.min(nums[1], nums[2]) + ' ' + Math.max(nums[1] + nums[2] - nums[0], 0));
};
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
function Main(input) {
    const nums = input.split(/\s/).map(str => { return parseInt(str) });
    const max = Math.min(nums[1], nums[2]);
    const min = Math.max(nums[1] + nums[2] - nums[0], 0);
    console.log(max + ' ' + min);
};
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
interface Unit {
  /** 料理の添え字 */
  i: number;
  /** 高橋生値 */
  tv: number;
  /** 青木生値 */
  av: number;
  /** 合計 */
  wa: number;
}
function main(input) {
  const args: string[] = input.split("\n");
  const N = parseInt(args[0]);
  const arr: Unit[] = [];
  for (let i = 0; i < N; i++) {
    const points: number[] = args[i + 1].split(" ").map(v => parseInt(v));
    arr.push({
      i: i,
      tv: points[0],
      av: points[1],
      wa: points[0] + points[1]
    });
  }
  arr.sort(mysort);
  let result = 0;
  for (let i = 0; i < N; i++) {
    if (i % 2 === 0) {
      // 偶数は高橋の独壇場
      result += arr[i].tv;
    } else {
      // 奇数は青木の独壇場
      result -= arr[i].av;
    }
  }
  console.log(`${result}`);
}

function mysort(a: Unit, b: Unit): number {
  const wa = b.wa - a.wa;
  if (wa !== 0) {
    return wa;
  } else {
    // 同じなのならば高い方からにすればよい
    return (a.tv - a.av) - (b.tv - b.av);
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input: String): void {
    const nums = input.split(/\s/).map(str => { return parseInt(str) });
    const max = Math.max(nums[1], nums[2]);
    const min = Math.max(nums[1] + nums[2] - nums[0], 0);
    console.log(max + ' ' + min);
};
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
function main(input) {
  const args = input.split(" ");
  const N = parseInt(args[0]);  
  const A = parseInt(args[1]);  
  const B = parseInt(args[2]);  
  const max = Math.max(A, B);
  const min = Math.max(0, ((A+B) - N));
  console.log(`${max} ${min}`)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
from itertools import combinations
def main():
    s = [i[0] for i in open(0).read().split()[1:]]
    c = (s.count("M"),s.count("A"),s.count("R"),s.count("C"),s.count("H"))
    a = sum(x*y*z for x, y, z in combinations(c, 3))
    print(a)
main()
//  [python]
def main():
    s = [i[0] for i in open(0).read().split()[1:]]
    c = (s.count("M"),s.count("A"),s.count("R"),s.count("C"),s.count("H"))
    a = 0
    for i in range(3):
        for j in range(3-i):
            for k in range(3-i-j):
                a += c[i]*c[i+j+1]*c[i+j+k+2]
    print(a)

main()
//  [python]
def main():
    from collections import Counter
    import itertools
    from math import factorial as f
    
    n, *s = open(0).read().split()
    i = [x[0] for x in s]
    d = Counter(i)
    c = [d.get(i) for i in 'MARCH' if d.get(i) != None]
    
    if len(c) < 3:
        ans = 0
    else:
        ans = 0
        for a,b,c in itertools.combinations(c,3):
          ans += a*b*c
    
    print(ans)

if __name__ == '__main__':
    main()
//  [python]
n=int(input())
l=[0,0,0,0,0]
for _ in range(n):
    s=input()
    if s[0]=='M':l[0]+=1
    if s[0] == 'A': l[1] += 1
    if s[0] == 'R': l[2] += 1
    if s[0] == 'C': l[3] += 1
    if s[0] == 'H': l[4] += 1
for i in l:
    if i==0:l.remove(i)
k=len(l)
if k<3:
    print(0)
    exit()
elif k==3:
    ans=1
    for i in l:
        ans += 1 * (i - 1)
elif k==4:
    ans=4
    for i in l:
        ans += 3 * (i - 1)
else:
    ans=10
    for i in l:
        ans+=6*(i-1)
print(ans)
//  [python]
import collections

N = int(input())
S = [input()[0] for _ in range(N)]
A = []
ans = 0 

for i in S:
    if i == 'M' or i == 'A' or i == 'R' or i == 'C' or i == 'H':
        A.append(i)
        
if len(A) != 0:       
    C = collections.Counter(A).most_common()
    v,c = zip(*C)
    s = c[0]

    for i in range(1,len(c)):
        s *= c[i]

    ans = s
    
print(ans)
//  [python]
import collections

N = int(input())
S = [input()[0] for _ in range(N)]
A = []
ans = 0 

for i in S:
    if i == 'M' or i == 'A' or i == 'R' or i == 'C' or i == 'H':
        A.append(i)
        
C = collections.Counter(A).most_common()
v,c =zip(*C)
s = c[0]

for i in range(1,len(c)):
    s *= c[i]
    
ans += s
print(ans)
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {

    int N;
    String[] S;

    private void solve() {
        N = nextInt();
        S = new String[N];

        long m = 0;
        long a = 0;
        long r = 0;
        long c = 0;
        long h = 0;

        for(int i = 0;i < N;i++) {
            S[i] = next();

            switch(S[i].charAt(0)) {
                case 'M':
                    m++;
                    break;
                case 'A':
                    a++;
                    break;
                case 'R':
                    r++;
                    break;
                case 'C':
                    c++;
                    break;
                case 'H':
                    h++;
                    break;
                default:
                    break;

            }
        }

        long ans = 0;
        ans += m * a * r;
        ans += m * a * c;
        ans += m * a * h;
        ans += m * r * c;
        ans += m * r * h;
        ans += m * c * h;
        ans += a * r * c;
        ans += a * r * h;
        ans += a * c * h;
        ans += r * c * h;

        out.println(ans);
    }
    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

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

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

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

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

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

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

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

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        int[] arr = new int[26];
        List<Integer> li = new ArrayList<>();

        for (int i = 0; i < N; ++i) {
            String s = fs.next();
            if (s.charAt(0) == 'M' || s.charAt(0) == 'A' || s.charAt(0) == 'C'
            || s.charAt(0) == 'R' || s.charAt(0) == 'H') {
                ++arr[s.charAt(0)-65];
            }
        }

        for (int i = 0; i < 25; ++i) {
            if (arr[i] != 0) {
                li.add(arr[i]);
            }
        }

        long ans = 0;
        for (int i = 0; i <= li.size()-3; ++i) {
            for (int j = i+1; j < li.size()-1; ++j) {
                for (int k = j+1; k < li.size(); ++k) {
                    ans += li.get(i) * li.get(j) * li.get(k);
                }
            }
        }

        System.out.println(ans);
    }
}

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

    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.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String s[] = new String[n];
        String march = "MARCH";
        int[] d = new int[5];
        for(int i=0;i<n;i++){
            s[i] = scanner.next();
            for(int j=0;j<5;j++){
                if(s[i].charAt(0) == march.charAt(j)){
                    d[j]++;
                    break;
                }
            }
        }

        int[] x = {0,0,0,0,0,0,1,1,1,2};
        int[] y = {1,1,1,2,2,3,2,2,3,3};
        int[] z = {2,3,4,3,4,4,3,4,4,4};
        long allCount = 0;
        for(int i=0;i<10;i++){
            allCount += d[x[i]] * d[y[i]] * d[z[i]];
        }
        System.out.println(allCount);
    }

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

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String s[] = new String[n];
        String march = "MARCH";
        int[] d = new int[5];
        for(int i=0;i<n;i++){
            s[i] = scanner.next();
            for(int j=0;j<5;j++){
                if(s[i].charAt(0) == march.charAt(j)){
                    d[j]++;
                    break;
                }
            }
        }

        int[] x = {0,0,0,0,0,0,1,1,1,2};
        int[] y = {1,1,1,2,2,3,2,2,3,3};
        int[] z = {2,3,4,3,4,4,3,4,4,4};
        int allCount = 0;
        for(int i=0;i<10;i++){
            allCount += d[x[i]] * d[y[i]] * d[z[i]];
        }
        System.out.println(allCount);
    }

}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
//KASRA FOULADI;
int main(){
    long long int n, ans = 0;
    cin >> n;
    int cnt[5] = {};
    char s[21];
    for(int i = 0; i < n; ++i){
        cin >> s;
        if(s[0] == 'M')
            ++ans;
        else if(s[0] == 'A')
            ++ans;
        else if(s[0] == 'R')
            ++ans;
        else if(s[0] == 'C')
            ++ans;
        else if(s[0] == 'H')
            ++ans;
    }
    cout << ans * (ans - 1)  * (ans - 2) / 6 << '\n';
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
//KASRA FOULADI;
int main(){
    long long int n, ans = 0;
    cin >> n;
    int cnt[5] = {};
    char s[21];
    for(int i = 0; i < n; ++i){
        cin >> s;
        if(s[0] == 'M')
            ++cnt[0];
        else if(s[0] == 'A')
            ++cnt[1];
        else if(s[0] == 'R')
            ++cnt[2];
        else if(s[0] == 'C')
            ++cnt[3];
        else if(s[0] == 'H')
            ++cnt[4];
    }
    for(int i = 0; i < 3; ++i)
        for(int j = i + 1; j < 4; ++j)
            for(int k = j + 1; k < 5; ++k)
                ans += cnt[i] * cnt[j] * cnt[k];
    cout << ans << '\n';
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
//KASRA FOULADI;
int main(){
    long long int n, ans = 0;
    cin >> n;
    int cnt[26] = {};
    char s[21];
    for(int i = 0; i < n; ++i){
        cin >> s;
        ++cnt[s[0] - 65];
    }
    for(int i = 0; i < 24; ++i)
        for(int j = i + 1; j < 25; ++j)
            for(int k = j + 1; k < 26; ++k)
                ans += cnt[i] *  cnt[j]  * cnt[k];
    cout << ans << '\n';
}
//  [c]
#include <stddef.h>
#include <stdio.h>
#include <inttypes.h>

#define MAX_PEOPLE 100000
#define NAME_LEN 12

char initial[MAX_PEOPLE];

uint64_t count_char(char* array, size_t size, char ch)
{
  uint64_t cnt = 0;
  for(size_t i = 0; i < size; i++) {
    if(array[i] == ch) {
      cnt++;
    }
  }
  return cnt;
}

int main()
{
  int num;
  char lf;
  scanf("%d%c", &num, &lf);
  for(int i = 0; i < num; i++) {
    char buf[NAME_LEN];
    fgets(buf, sizeof(buf), stdin);
    initial[i] = buf[0];
  }
  uint64_t a = count_char(initial, num, 'A');
  uint64_t c = count_char(initial, num, 'C');
  uint64_t h = count_char(initial, num, 'H');
  uint64_t m = count_char(initial, num, 'M');
  uint64_t r = count_char(initial, num, 'R');

  uint64_t result = 0;
  result += a * c * h;
  result += a * c * m;
  result += a * c * r;
  result += a * h * m;
  result += a * h * r;
  result += a * m * r;
  result += c * h * m;
  result += c * h * r;
  result += c * m * r;
  result += h * m * r;
  printf("%" PRIu64 "\n", result);
  return 0;
}
//  [c]
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_CHAR_KIND		5										// 文字種類

// 内部変数
static long long sl1Cnt[D_CHAR_KIND];							// 各文字毎の人数
static long long slSum;											// 合計

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, j, k;
	char lc1Buf[1024], lc1Out[1024];

	// データ初期化
	memset(sl1Cnt, 0, sizeof(sl1Cnt));							// 各文字毎の人数
	slSum = 0;													// 合計

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 人数取得
	int liHCnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d", &liHCnt);

	// 各文字毎の人数セット
	for (i = 0; i < liHCnt; i++) {
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif

		switch (lc1Buf[0]) {
			case 'M':	sl1Cnt[0]++;	break;
			case 'A':	sl1Cnt[1]++;	break;
			case 'R':	sl1Cnt[2]++;	break;
			case 'C':	sl1Cnt[3]++;	break;
			case 'H':	sl1Cnt[4]++;	break;
		}
	}

	// 合計セット
	for (i = 0; i < D_CHAR_KIND; i++) {
		for (j = i + 1; j < D_CHAR_KIND; j++) {
			for (k = j + 1; k < D_CHAR_KIND; k++) {
				slSum += sl1Cnt[i] * sl1Cnt[j] * sl1Cnt[k];
			}
		}
	}

	// 結果セット
	sprintf(lc1Out, "%lld\n", slSum);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
 
int main(){
  int n;
  long int ans;
  scanf("%d", &n);
  int i;
  long int m=0,a=0,r=0,c=0,h=0;
  
  char s[n+1][12];
  
  for(i=0;i<=n;i++)	gets(s[i]);
  
  for(i=0;i<=n;i++){
    switch(s[i][0]){
      case 'M':m++;break;
      case 'A':a++;break;
      case 'R':r++;break;
      case 'C':c++;break;
      case 'H':h++;break;
      
    }
  }
  ans = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h;
  
  printf("%lld", ans);
  
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n,m=0,a=0,r=0,c=0,h=0;
  long long sum=0;
  char s[10];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%s",s);
    if(s[0]=='M') m++;
    if(s[0]=='A') a++;
    if(s[0]=='R') r++;
    if(s[0]=='C') c++;
    if(s[0]=='H') h++;
    s[0] = '\0';
  }
  sum+=m*a*r;
  sum+=m*a*c;
  sum+=m*a*h;
  sum+=m*r*c;
  sum+=m*r*h;
  sum+=m*c*h;
  sum+=a*r*c;
  sum+=a*r*h;
  sum+=a*c*h;
  sum+=r*c*h;

  printf("%lld",sum);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n,m=0,a=0,r=0,c=0,h=0;
  long long sum=0;
  char s[100005][10];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%*c%s",s[i]);
    if(s[i][0]=='M') m++;
    if(s[i][0]=='A') a++;
    if(s[i][0]=='R') r++;
    if(s[i][0]=='C') c++;
    if(s[i][0]=='H') h++;
  }
  sum+=m*a*r;
  sum+=m*a*c;
  sum+=m*a*h;
  sum+=m*r*c;
  sum+=m*r*h;
  sum+=m*c*h;
  sum+=a*r*c;
  sum+=a*r*h;
  sum+=a*c*h;
  sum+=r*c*h;

  printf("%lld",sum);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int n,m=0,a=0,r=0,c=0,h=0;
  long long sum=0;
  char s[10];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%s",s);
    if(s[0]=='M') m++;
    if(s[0]=='A') a++;
    if(s[0]=='R') r++;
    if(s[0]=='C') c++;
    if(s[0]=='H') h++;
  }
  sum+=m*a*r;
  sum+=m*a*c;
  sum+=m*a*h;
  sum+=m*r*c;
  sum+=m*r*h;
  sum+=m*c*h;
  sum+=a*r*c;
  sum+=a*r*h;
  sum+=a*c*h;
  sum+=r*c*h;

  printf("%lld",sum);
  return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var N = Number(line[0]);
	var ary_march = ["M", "A", "R", "C", "H"];
	var obj =
		{"M" : 0
		,"A" : 0
		,"R" : 0
		,"C" : 0
		,"H" : 0};

	var ans = 0;

	for(var i = 1; i < N+1; i++){
		var initial = line[i][0];
		if(initial === "M") obj.M++;
		else if(initial === "A") obj.A++;
		else if(initial === "R") obj.R++;
		else if(initial === "C") obj.C++;
		else if(initial === "H") obj.H++;
	}
	var ia = [];
	for(var key in obj){
		if(obj[key] !== 0) ia.push(obj[key]);
	}
	if(ia.length === 3){
		ans = ia[0]*ia[1]*ia[2];
	} else if(ia.length === 4){
		ans = ia[0]*ia[1]*ia[2] + ia[3]*ia[0]*ia[1] + ia[2]*ia[3]*ia[0] + ia[1]*ia[2]*ia[3];
	} else if(ia.length === 5){
		ans = ia[0]*ia[1]*ia[2] + ia[0]*ia[1]*ia[3] + ia[0]*ia[1]*ia[4] + ia[0]*ia[2]*ia[3] + ia[0]*ia[2]*ia[4]
			+ ia[0]*ia[3]*ia[4] + ia[1]*ia[2]*ia[3] + ia[1]*ia[2]*ia[4] + ia[1]*ia[3]*ia[4] + ia[2]*ia[3]*ia[4];
	}
	console.log(ans);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、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 = () => {
    let n = nextInt()
    let map = {}
    while (hasNext()) {
        let first = next()[0]
        if (!map[first]) map[first] = 1
        else map[first]++
    }
    let ans = 0n
    let march = ['M', 'A', 'R', 'C', 'H']
    for (let i = 0; i < march.length - 2; i++) {
        for (let j = i + 1; j < march.length - 1; j++) {
            for (let k = j + 1; k < march.length; k++) {
                if(!map[march[i]] || !map[march[j]] || !map[march[k]]) continue
                ans += BigInt(map[march[i]]) * BigInt(map[march[j]]) * BigInt(map[march[k]])
            }
        }
    }
    console.log(Number(ans))
}
Main()
//  [javascript]
'use strict'
function main(inp) {
  inp = inp.trim().split('\n')
  inp.shift()
  const P = [0,0,0,0,0,0,1,1,1,2];
  const Q = [1,1,1,2,2,3,2,2,3,3];
  const R = [2,3,4,3,4,4,3,4,4,4];
  let S = new Array(5).fill(0)

  inp.forEach(str => {
    const index = 'MARCH'.indexOf(str[0])
    if (~index) S[index]++
  })
  let ans = 0
  for (let i = 0; i < 10; i++) {
    ans += S[P[i]] * S[Q[i]] * S[R[i]]
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));