import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.BiFunction;
import java.util.function.IntBinaryOperator;
import java.util.function.LongBinaryOperator;
import java.util.stream.*;
// import static java.util.Arrays.compare;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
import static java.util.Comparator.reverseOrder;
// import static java.util.List.of;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

import java.math.BigInteger;
import static java.math.BigInteger.ZERO;
import static java.math.BigInteger.ONE;
// import static java.math.BigInteger.TWO;
import static java.math.BigInteger.TEN;

import static java.lang.Math.PI;
import static java.lang.Math.E;
import static java.lang.Math.min;
import static java.lang.Math.max;
import static java.lang.Math.abs;
import static java.lang.Math.sin;
import static java.lang.Math.cos;
import static java.lang.Math.tan;
import static java.lang.Math.asin;
import static java.lang.Math.acos;
import static java.lang.Math.atan;
import static java.lang.Math.atan2;
import static java.lang.Math.hypot;
import static java.lang.Math.sqrt;
import static java.lang.Math.log;
import static java.lang.Math.exp;
import static java.lang.String.format;
import static java.lang.System.exit;
import static java.lang.System.currentTimeMillis;

public class Main {
    public static long MOD = 1_000_000_007;

    public static void main(final String[] args) {
        final FastScanner fsc = new FastScanner();
        int n=fsc.nextInt();
        int a=fsc.nextInt();
        int b=fsc.nextInt();
        fsc.close();
        System.out.println(min(a, b)+" "+max(a+b-n, 0));
    }

    static class IntUtil {
        public static int min(final int a, final int... b) {
            int ret = a;
            for (final int c : b) {
                ret = Math.min(ret, c);
            }
            return ret;
        }

        public static int max(final int a, final int... b) {
            int ret = a;
            for (final int c : b) {
                ret = Math.max(ret, c);
            }
            return ret;
        }

        /**
         * Caluculate the ceil of a/b. Returns the smallest integer greater than or
         * equal to a/b while 'a/b' rounds fractional parts to ZERO.
         *
         * @param a
         * @param b
         * @return the smallest integer greater than or equal to a/b
         */
        public static int ceilDiv(final int a, final int b) {
            if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
                if (b > 0) {
                    return (a + b - 1) / b;
                } else {
                    return (a + b + 1) / b;
                }
            } else {
                return a / b;
            }
        }

        /**
         * Caluculate the floor of a/b. Returns the largest integer less than or equal
         * to a/b while 'a/b' rounds fractional parts to ZERO.
         *
         * @param a
         * @param b
         * @return the largest integer less than or equal to a/b
         */
        public static int floorDiv(final int a, final int b) {
            if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
                return a / b;
            } else {
                if (b > 0) {
                    return (a - b + 1) / b;
                } else {
                    return (a - b - 1) / b;
                }
            }
        }

        public static int fold(final IntBinaryOperator func, final int a, final int... b) {
            int ret = a;
            for (final int c : b) {
                ret = func.applyAsInt(ret, c);
            }
            return ret;
        }
    }

    static class LongUtil {
        public static long min(final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                ret = Math.min(ret, c);
            }
            return ret;
        }

        public static long max(final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                ret = Math.max(ret, c);
            }
            return ret;
        }

        /**
         * Caluculate the ceil of a/b. Returns the smallest integer greater than or
         * equal to a/b while 'a/b' rounds fractional parts to ZERO.
         *
         * @param a
         * @param b
         * @return the smallest integer greater than or equal to a/b
         */
        public static long ceilDiv(final long a, final long b) {
            if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
                if (b > 0) {
                    return (a + b - 1) / b;
                } else {
                    return (a + b + 1) / b;
                }
            } else {
                return a / b;
            }
        }

        /**
         * Caluculate the floor of a/b. Returns the largest integer less than or equal
         * to a/b while 'a/b' rounds fractional parts to ZERO.
         *
         * @param a
         * @param b
         * @return the largest integer less than or equal to a/b
         */
        public static long floorDiv(final long a, final long b) {
            if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
                return a / b;
            } else {
                if (b > 0) {
                    return (a - b + 1) / b;
                } else {
                    return (a - b - 1) / b;
                }
            }
        }

        public static long fold(final LongBinaryOperator func, final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                ret = func.applyAsLong(ret, c);
            }
            return ret;
        }
    }

    static class MathUtil {
        /**
         * Enumarate primes less than n.
         *
         * @param n
         * @return {@code ArrayList} that holds primes.
         */
        public static ArrayList<Integer> eratosthenes(final int n) {
            final int[] div = eratosthenesDivisors(n);
            final ArrayList<Integer> result = new ArrayList<>();
            for (int i = 2; i <= n; i++) {
                if (div[i] == i) {
                    result.add(i);
                }
            }
            return result;
        }

        /**
         * execute eratosthenes's prime-enumerate algorithm. a[i] holds the greatest
         * divisor of i. if a[i]=i, i is a prime number. This arrary enables you to
         * prime-factorize in O(log n) time. (<O(sqrt n)).
         *
         * @param n
         * @return divisor array.
         */
        public static int[] eratosthenesDivisors(final int n) {
            final int[] divisors = new int[n + 1];
            if (n <= 0) {
                return null;
            }
            for (int i = 1; i <= n; i++) {
                if ((i & 1) != 0) {
                    divisors[i] = i;
                } else {
                    divisors[i] = 2;
                }
            }
            for (long i = 3; i <= n; i += 2) {
                if (divisors[(int) i] == (int) i) {
                    for (long j = i * i; j <= n; j += (i << 1)) {
                        divisors[(int) j] = (int) i;
                    }
                }
            }
            return divisors;
        }

        /**
         * Caluculate prime-factorization.
         *
         * @param n
         * @return {@code HashMap} of {prime: index}
         */
        public static HashMap<Long, Integer> primeFactorization(long n) {
            final HashMap<Long, Integer> primes = new HashMap<Long, Integer>();
            for (long p = 2; p * p <= n; p++) {
                int q = 0;
                while (n % p == 0) {
                    n /= p;
                    q++;
                }
                if (q > 0) {
                    primes.put(p, q);
                }
            }
            if (n > 1) {
                primes.put(n, 1);
            }
            return primes;
        }

        private static HashMap<Long, Integer> lcm(final HashMap<Long, Integer> amap,
                final HashMap<Long, Integer> bmap) {
            if (amap.size() < bmap.size()) {
                return lcm(bmap, amap);
            }
            final HashMap<Long, Integer> lcm = amap;
            for (final Map.Entry<Long, Integer> e : bmap.entrySet()) {
                final long prime = e.getKey();
                if (lcm.containsKey(prime)) {
                    lcm.put(prime, Math.max(lcm.get(prime), e.getValue()));
                } else {
                    lcm.put(prime, e.getValue());
                }
            }
            return lcm;
        }

        private static HashMap<Long, Integer> lcm(final HashMap<Long, Integer> amap, final long b) {
            final HashMap<Long, Integer> bmap = primeFactorization(b);
            return lcm(amap, bmap);
        }

        public static HashMap<Long, Integer> lcm(final long a, final long... b) {
            HashMap<Long, Integer> amap = primeFactorization(a);
            for (final long c : b) {
                amap = lcm(amap, c);
            }
            return amap;
        }

        public static long unsafeLCM(final long a, final long b) {
            return a * b / gcd(a, b);
        }

        /**
         * Caluculate the GCD of (a, b)/
         *
         * @param a first value
         * @param b second value
         * @return GCD(a, b)
         */
        public static long gcd(long a, long b) {
            if (a < b) {
                return gcd(b, a);
            }
            long r = a % b;
            while (r != 0) {
                a = b;
                b = r;
                r = a % b;
            }
            return b;
        }

        /**
         * Return one of the solutions to {@code ax+by=gcd(a, b)}.
         *
         * @return {@code x}, {@code y}, {@code gcd(a, b)}.
         * @param a a of ax+by=gcd(a, b).
         * @param b b of ax+by=gcd(a, b). class ReferenceLong is a reference type of
         *          long.
         */
        public static long[] extGCD(final long a, final long b) {
            final ReferenceLong x = new ReferenceLong();
            final ReferenceLong y = new ReferenceLong();
            final long[] ret = new long[3];
            ret[2] = extGCD(a, b, x, y);
            ret[0] = x.v;
            ret[1] = y.v;
            return ret;
        }

        private static long extGCD(final long a, final long b, final ReferenceLong x, final ReferenceLong y) {
            if (b == 0) {
                x.v = 1;
                y.v = 0;
                return a;
            }
            final long d = extGCD(b, a % b, y, x);
            y.v -= a / b * x.v;
            return d;
        }

        private static class ReferenceLong {
            long v = 0;
        }
    }

    static class IntArrayUtil {
        public static void reverse(final int[] a, final int begin, final int end) {
            for (int i = begin; i < begin + (end - begin) / 2; i++) {
                swap(a, i, begin + end - i - 1);
            }
        }

        public static void reverse(final int[] a) {
            reverse(a, 0, a.length);
        }

        public static void revSort(final int[] a) {
            Arrays.sort(a);
            reverse(a);
        }

        public static int[] nextPermutation(final int[] a) {
            final int[] ret = a.clone();
            final int n = ret.length;
            for (int i = n - 1; i >= 1; i--) {
                if (ret[i] > ret[i - 1]) {
                    int fail = n, pass = i;
                    while (fail - pass > 1) {
                        final int mid = pass + (fail - pass) / 2;
                        if (ret[mid] > ret[i - 1])
                            pass = mid;
                        else
                            fail = mid;
                    }
                    swap(ret, pass, i - 1);
                    reverse(ret, i, n);
                    return ret;
                }
            }
            return null;
        }

        public static int[] predPermutation(final int[] a) {
            final int[] ret = a.clone();
            final int n = ret.length;
            for (int i = n - 1; i >= 1; i--) {
                if (ret[i] < ret[i - 1]) {
                    int fail = n, pass = i;
                    while (fail - pass > 1) {
                        final int mid = pass + (fail - pass) / 2;
                        if (ret[mid] < ret[i - 1])
                            pass = mid;
                        else
                            fail = mid;
                    }
                    swap(ret, pass, i - 1);
                    reverse(ret, i, n);
                    return ret;
                }
            }
            return null;
        }

        public static void swap(final int[] a, final int u, final int v) {
            final int tmp = a[u];
            a[u] = a[v];
            a[v] = tmp;
        }

        public static int compare(final int[] a, final int[] b) {
            for (int i = 0; i < a.length; i++) {
                if (i >= b.length) {
                    return -1;
                } else if (a[i] > b[i]) {
                    return 1;
                } else if (a[i] < b[i]) {
                    return -1;
                }
            }
            if (a.length < b.length) {
                return 1;
            } else {
                return 0;
            }
        }

        public static boolean equals(final int[] a, final int[] b) {
            return compare(a, b) == 0;
        }
    }

    static class LongArrayUtil {
        public static void reverse(final long[] a, final int begin, final int end) {
            for (int i = begin; i < begin + (end - begin) / 2; i++) {
                final long tmp = a[i];
                a[i] = a[begin + end - i - 1];
                a[begin + end - i - 1] = tmp;
            }
        }

        public static void reverse(final long[] a) {
            reverse(a, 0, a.length);
        }

        public static void revSort(final long[] a) {
            Arrays.sort(a);
            reverse(a);
        }

        public static void compress(final long[] a) {
            final int n = a.length;
            final long[] sorted = a.clone();
            Arrays.sort(sorted);
            for (int i = 0; i < n; i++) {
                int l = 0, r = n;
                while (r - l > 1) {
                    final int m = l + (r - l) / 2;
                    if (sorted[m] <= a[i])
                        l = m;
                    else
                        r = m;
                }
                a[i] = l;
            }
        }

        public static long[] nextPermutation(final long[] a) {
            final long[] ret = a.clone();
            final int n = ret.length;
            for (int i = n - 1; i >= 1; i--) {
                if (ret[i] > ret[i - 1]) {
                    int fail = n, pass = i;
                    while (fail - pass > 1) {
                        final int mid = pass + (fail - pass) / 2;
                        if (ret[mid] > ret[i - 1])
                            pass = mid;
                        else
                            fail = mid;
                    }
                    swap(ret, pass, i - 1);
                    reverse(ret, i, n);
                    return ret;
                }
            }
            return null;
        }

        public static long[] predPermutation(final long[] a) {
            final long[] ret = a.clone();
            final int n = ret.length;
            for (int i = n - 1; i >= 1; i--) {
                if (ret[i] < ret[i - 1]) {
                    int fail = n, pass = i;
                    while (fail - pass > 1) {
                        final int mid = pass + (fail - pass) / 2;
                        if (ret[mid] < ret[i - 1])
                            pass = mid;
                        else
                            fail = mid;
                    }
                    swap(ret, pass, i - 1);
                    reverse(ret, i, n);
                    return ret;
                }
            }
            return null;
        }

        public static void swap(final long[] a, final int u, final int v) {
            final long tmp = a[u];
            a[u] = a[v];
            a[v] = tmp;
        }

        public static int compare(final long[] a, final long[] b) {
            for (int i = 0; i < a.length; i++) {
                if (i >= b.length) {
                    return -1;
                } else if (a[i] > b[i]) {
                    return 1;
                } else if (a[i] < b[i]) {
                    return -1;
                }
            }
            if (a.length < b.length) {
                return 1;
            } else {
                return 0;
            }
        }

        public static boolean equals(final long[] a, final long[] b) {
            return compare(a, b) == 0;
        }
    }

    static class ModUtil {
        private static long safeMAX = 100_000_000_000_000_000l;

        public static long modFold(final LongBinaryOperator function, final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                ret = function.applyAsLong(ret, c);
                ret %= MOD;
            }
            return ret;
        }

        public static long modAdd(final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                if (ret >= safeMAX || ret <= -safeMAX) {
                    ret %= MOD;
                }
                ret += c;
            }
            return ret;
        }

        public static long modMul(final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                ret *= c;
                ret %= MOD;
            }
            return ret;
        }

        public static long modDiv(final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                ret *= modinv(c);
                ret %= MOD;
            }
            return ret;
        }

        public static long modSub(final long a, final long... b) {
            long ret = a;
            for (final long c : b) {
                ret -= c;
                if (ret >= safeMAX || ret <= -safeMAX) {
                    ret %= MOD;
                }
            }
            ret %= MOD;
            if (ret < 0) {
                ret += MOD;
            }
            return ret;
        }

        /**
         * Caluculate the value b s.t. a*b mod MOD = 1.
         *
         * @param a
         * @return inverse of a
         */
        public static long modinv(long a) {
            long b = MOD;
            long u = 1, v = 0;
            while (b >= 1) {
                final long t = a / b;
                a -= t * b;
                final long tmp1 = a;
                a = b;
                b = tmp1;
                u -= t * v;
                final long tmp2 = u;
                u = v;
                v = tmp2;
            }
            u %= MOD;
            return u >= 0 ? u : u + MOD;
        }

        /**
         * Caluculate the combination nCr.
         *
         * @param n left
         * @param r right
         * @return nCr
         */
        public static long comb(long n, long r) {
            if (n < r) {
                return 0;
            }
            r = Math.min(r, n - r);
            long res = 1;
            for (long d = 1; d <= r; d++) {
                res *= n;
                res %= MOD;
                n--;
                res *= modinv(d);
                res %= MOD;
            }
            return res;
        }
    }

    static 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 (final 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(final 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();
            final 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() {
            final 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());
        }

        public void close() {
            try {
                in.close();
            } catch (final Exception e) {
                e.printStackTrace();
            }
        }
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
// import java.awt.Point;

public class Main {
    InputStream is;
    PrintWriter out;
    String INPUT = "";

    static int mod = 1_000_000_007;
    long inf = Long.MAX_VALUE;

    void solve(){
        int n = ni();
        int a = ni();
        int b = ni();
        int max = Math.min(a,b);
        int min = Math.max(0, a+b-n);
        out.println(max+" "+min);
    }

    void run() throws Exception
    {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        out.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    public static void main(String[] args) throws Exception { new Main().run(); }

    private byte[] inbuf = new byte[1024];
    private int lenbuf = 0, ptrbuf = 0;

    private int readByte()
    {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns()
    {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b) && b != ' ')){
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n)
    {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m)
    {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n)
    {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni()
    {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl()
    {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }

}


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);
	}

}


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);
    }

  }
}


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);
    }

  }
}


import java.io.*;
import java.util.*;

public class Main {
	static InputReader scn = new InputReader(System.in);
	static OutputWriter out = new OutputWriter(System.out);

	public static void main(String[] args) {
		int t = 1;
		while (t-- > 0)
			solve();
		out.close();
	}

// 100 79

	public static void solve() {
		int n = scn.nextInt();
		int a = scn.nextInt();
		int b = scn.nextInt();
		int val = a + b;
		int min = Math.min(a, b);
		if (n > val) {
			out.println(min + " " + 0);
		} else {
			out.println(min + " " + (n - (val)));
		}
	}

	public static boolean check(int a, int b, int c, int d) {
		int[] arr = { a, b, c, d };
		int odd = 0;
		int even = 0;
		for (int i = 0; i < 4; i++) {
			if (arr[i] % 2 == 0) {
				even++;
			} else {
				odd++;
			}
		}
//		System.out.println(even + " " + odd);
		if (even == 4 || even == 3 && odd == 1) {
			return true;
		}
		return false;
	}

	public static int gcd(int a, int b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	public static int lcm(int a, int b) {
		return (a * b) / gcd(a, b);
	}

	public static boolean isPrime(long n) {
		if (n < 2)
			return false;
		if (n == 2 || n == 3)
			return true;
		if (n % 2 == 0 || n % 3 == 0)
			return false;
		long sqrtN = (long) Math.sqrt(n) + 1;
		for (long i = 6L; i <= sqrtN; i += 6) {
			if (n % (i - 1) == 0 || n % (i + 1) == 0)
				return false;
		}
		return true;
	}

	public static HashMap<Integer, Integer> CountFrequencies(int[] arr) {
		HashMap<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < arr.length; i++) {
			int a = arr[i];
			if (map.containsKey(a)) {
				map.put(a, map.get(a) + 1);
			} else {
				map.put(a, 1);
			}
		}
		return map;
	}

	public static int[] readArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scn.nextInt();
		}
		return a;
	}

	public static int countPrimeFactors(int n) {
		int count = 0;
		while (n % 2 == 0) {
			n = n / 2;
			count++;
		}
		for (int i = 3; i <= Math.sqrt(n); i = i + 2) {
			while (n % i == 0) {
				n = n / i;
				count++;
			}
		}
		if (n > 2)
			count++;
		return (count);
	}

	public static ArrayList<Integer> printKAlmostPrimes(int n) {
		ArrayList<Integer> list = new ArrayList<>();
		for (int i = 1, num = 2; i <= n; num++) {
			if (countPrimeFactors(num) == 2) {
				if (num > n) {
					break;
				}
				list.add(num);
				i++;
			}
		}
		return list;
	}

	public static int[] SieveOfEratosthenes(int[] arr) {
		int n = arr.length;
		for (int i = 3; i < n; i = i + 2) {
			arr[i] = 1;
		}
		for (int i = 3; i < n; i = i + 2) {
			if (arr[i] == 1) {
				for (int j = i * i; j < n; j = j + i) {
					arr[j] = 0;
				}
			}
		}
		arr[2] = 1;
		arr[0] = arr[1] = 0;
		return arr;
	}

	static void sort(int[] a) {
		ArrayList<Integer> l = new ArrayList<>();
		for (int i : a) {
			l.add(i);
		}
		Collections.sort(l);
		for (int i = 0; i < a.length; i++) {
			a[i] = l.get(i);
		}
	}

	public static ArrayList<String> printPermutn(String str, String ans, ArrayList<String> list) {
		if (str.length() == 0) {
			list.add(ans);
		}
		for (int i = 0; i < str.length(); i++) {
			char ch = str.charAt(i);
			String ros = str.substring(0, i) + str.substring(i + 1);
			printPermutn(ros, ans + ch, list);
		}
		return list;
	}

	public static ArrayList<String> GetSubSequences(String s) {
		if (s.length() == 0) {
			ArrayList<String> br = new ArrayList<>();
			br.add("");
			return br;
		}
		char ch = s.charAt(0);
		String ms = s.substring(1);

		ArrayList<String> rr = GetSubSequences(ms);

		ArrayList<String> mr = new ArrayList<>();

		int t = rr.size();
		for (int i = 0; i < t; i++) {
			mr.add(rr.get(i));
			mr.add(ch + rr.get(i));

		}

		return mr;

	}

	public static int binarySearch(int arr[], int l, int r, int x) {
		if (r >= l) {
			int mid = l + (r - l) / 2;
			if (arr[mid] == x)
				return mid;
			if (arr[mid] > x)
				return binarySearch(arr, l, mid - 1, x);
			return binarySearch(arr, mid + 1, r, x);
		}
		return -1;
	}

	public static int firstOccurence(int array1[], int low, int high, int x, int n) {
		if (low <= high) {
			int mid = low + (high - low) / 2;
			if ((mid == 0 || x > array1[mid - 1]) && array1[mid] == x)
				return mid;
			else if (x > array1[mid])
				return firstOccurence(array1, (mid + 1), high, x, n);
			else
				return firstOccurence(array1, low, (mid - 1), x, n);
		}
		return -1;
	}

	public static int lastOccurence(int array2[], int low, int high, int x, int n) {
		if (low <= high) {
			int mid = low + (high - low) / 2;
			if ((mid == n - 1 || x < array2[mid + 1]) && array2[mid] == x)
				return mid;
			else if (x < array2[mid])
				return lastOccurence(array2, low, (mid - 1), x, n);
			else
				return lastOccurence(array2, (mid + 1), high, x, n);
		}
		return -1;
	}

	public static void quickSort(int[] arr, int lo, int hi) {
		if (lo >= hi) {
			return;
		}
		int mid = (lo + hi) / 2;
		int pivot = arr[mid];
		int left = lo;
		int right = hi;
		while (left <= right) {
			while (arr[left] < pivot) {
				left++;
			}
			while (arr[right] > pivot) {
				right--;
			}
			if (left <= right) {
				int temp = arr[left];
				arr[left] = arr[right];
				arr[right] = temp;
				left++;
				right--;
			}
		}
		quickSort(arr, lo, right);
		quickSort(arr, left, hi);
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return nextLine();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0) {
					writer.print(' ');
//                    writer.print(1);
				}
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}

}


#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);
}


#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;
}


#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;
}


#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;
	}
}


    #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;
}


#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cout << min(a,b) << " " << max(0,a+b-n) << endl;
}


#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;
}


#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;
}


#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;
}


#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;
}


#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;
}


#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;
}


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());


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"));


// 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"));


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"));


// 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"));


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
}


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)
}


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)))
}


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)
}


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
}


// 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)
}


#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)}"


n, a, b = gets.chomp.split.map(&:to_i)
puts "%d %d" % [[a, b].min, [a + b - n, 0].max]


n,a,b=gets.split.map &:to_i
printf "%d %d\n",[a,b].min,[a+b-n,0].max


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]


n, a, b = gets.split().map(&:to_i)

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

puts [max, min]


n,a,b=gets.split.map &:to_i
puts "#{[a,b].min} #{[a,b].max-n+[a,b].min}"


#[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));
}


#![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));
}


#![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);
}


fn main() {
    proconio::input! {
    a:[isize;3],
    }
    println!("{} {}",min(a[1],a[2]),max(a[1]+a[2]-a[0],0))
}


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));
}


#![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);
    }
}


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))


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)


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);
	}
}


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"));


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'));


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'));


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"));


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'));


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"));


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()


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()


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()


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)


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)


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)


import java.io.*;
import java.util.*;

class Main {
    static char[] carr = {'M','A','R','C','H'};
    static List<String> combs;
    static StringBuilder sb;
    public static void main(String args[]) throws IOException {
        Scan sc = new Scan();
        int n = sc.scanInt();
        int[] freq = new int[256];
        for(int i = 0; i < n; ++i){
            char first = sc.scanString().charAt(0);
            freq[first]++;
        }
        long res= 0;
        fillCombs();
        for(String str : combs){
            long tres = 1;
            for(char c : str.toCharArray()){
                tres *=(freq[c]);
            }
            res += tres;
        }
        System.out.println(res);
    }

    static void fillCombs(){
        sb = new StringBuilder();
        combs = new ArrayList<String>();
        for(int i = 0; i < 5; ++i){
            char a = carr[i];
            for(int j= i+1; j < 5; ++j){
                char b = carr[j];
                for(int k = j+1; k < 5; ++k){
                    char c = carr[k];
                    sb.append(a).append(b).append(c);
                    combs.add(sb.toString());
                    sb.setLength(0);
                }
            }
        }
    }

}

class Scan
{
    private byte[] buf=new byte[1024];
    private int index;
    private InputStream in;
    private int total;
    public Scan()
    {
        in=System.in;
    }
    public int scan()throws IOException
    {
        if(total<0)
        throw new InputMismatchException();
        if(index>=total)
        {
            index=0;
            total=in.read(buf);
            if(total<=0)
            return -1;
        }
        return buf[index++];
    }
    public int scanInt()throws IOException
    {
        int integer=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n))
        {
            if(n>='0'&&n<='9')
            {
                integer*=10;
                integer+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }
    public long scanLong() throws IOException {
        long integer=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n))
        {
            if(n>='0'&&n<='9')
            {
                integer*=10;
                integer+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }
    public double scanDouble()throws IOException
    {
        double doub=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n)&&n!='.')
        {
            if(n>='0'&&n<='9')
            {
                doub*=10;
                doub+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        if(n=='.')
        {
            n=scan();
            double temp=1;
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    temp/=10;
                    doub+=(n-'0')*temp;
                    n=scan();
                }
                else throw new InputMismatchException();
            }
        }
        return doub*neg;
    }
    public String scanString()throws IOException
    {
        StringBuilder sb=new StringBuilder();
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        while(!isWhiteSpace(n))
        {
            sb.append((char)n);
            n=scan();
        }
        return sb.toString();
    }
    private boolean isWhiteSpace(int n)
    {
        if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
        return true;
        return false;
    }
}


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());
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
        public static void main(String[] args) {
                InputStream inputStream = System.in;
                OutputStream outputStream = System.out;
                InputReader in = new InputReader(inputStream);
                PrintWriter out = new PrintWriter(outputStream);
                TaskC solver = new TaskC();
                solver.solve(1, in, out);
                out.close();
        }

        static class TaskC {
                int[][] perm = new int[10][3];
                int ind = 0;

                public void solve(int testNumber, InputReader in, PrintWriter out) {
                        //generatePermutation(new int[]{0,1,2},3,3);
                        getCombination(new int[]{0, 1, 2, 3, 4}, 5, 3);
                        //for (int i = 0; i < 10; i++) out.println(Arrays.toString(perm[i]));
                        int n = in.i();
                        long[] d = new long[5];
                        for (int i = 0; i < n; i++) {
                                String s = in.s();
                                if (s.charAt(0) == 'M') d[0]++;
                                if (s.charAt(0) == 'A') d[1]++;
                                if (s.charAt(0) == 'R') d[2]++;
                                if (s.charAt(0) == 'C') d[3]++;
                                if (s.charAt(0) == 'H') d[4]++;
                        }

                        long ans = 0;
                        for (int i = 0; i < 10; i++) {
                                ans += d[perm[i][0]] * d[perm[i][1]] * d[perm[i][2]];
                        }
                        out.println(ans);
                }

                void getCombination(int[] a, int n, int r) {
                        int[] data = new int[n];
                        combinationUtil(a, n, r, 0, data, 0);
                }

                private void combinationUtil(int[] a, int n, int r, int index, int[] data, int i) {
                        if (index == r) {
                                perm[ind++] = Arrays.copyOf(data, r);
                                return;
                        }
                        if (i >= n) return;
                        data[index] = a[i];
                        combinationUtil(a, n, r, index + 1, data, i + 1);
                        combinationUtil(a, n, r, index, data, i + 1);
                }

        }

        static class InputReader {
                InputStream is;
                private byte[] inbuf = new byte[1024];
                public int lenbuf = 0;
                public int ptrbuf = 0;

                public InputReader(InputStream is) {
                        this.is = is;
                }

                private int readByte() {
                        if (lenbuf == -1) throw new InputMismatchException();
                        if (ptrbuf >= lenbuf) {
                                ptrbuf = 0;
                                try {
                                        lenbuf = is.read(inbuf);
                                } catch (IOException e) {
                                        throw new InputMismatchException();
                                }
                                if (lenbuf <= 0) return -1;
                        }
                        return inbuf[ptrbuf++];
                }

                private boolean isSpaceChar(int c) {
                        return !(c >= 33 && c <= 126);
                }

                private int skip() {
                        int b;
                        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
                        return b;
                }

                public String s() {
                        int b = skip();
                        StringBuilder sb = new StringBuilder();
                        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
                                sb.appendCodePoint(b);
                                b = readByte();
                        }
                        return sb.toString();
                }

                public int i() {
                        int num = 0, b;
                        boolean minus = false;
                        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
                        if (b == '-') {
                                minus = true;
                                b = readByte();
                        }

                        while (true) {
                                if (b >= '0' && b <= '9') {
                                        num = num * 10 + (b - '0');
                                } else {
                                        return minus ? -num : num;
                                }
                                b = readByte();
                        }
                }

        }
}


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());}
}


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);
    }

}


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);
    }

}


#include <cstdio>
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <cstddef>
#include <cinttypes>

#include <type_traits>
#include <limits>

namespace FastIn {
  static constexpr size_t BUF_SIZE=1<<17, INT_LEN=24, FLT_LEN=400;
  static char buf[BUF_SIZE|1]={}, *pos=buf, *endbuf=nullptr;
  FILE *fin;

  inline bool rebuffer() {
    // returns true <=> there is at least one unread character
    size_t rest=endbuf-pos;
    if (buf+rest > pos) {
      // buf[:pos] and buf[-pos:] are overlapping, which std::memcpy()
      // causes undefined behavior.
      return true;
    }

    std::memcpy(buf, pos, rest);
    pos = buf;
    size_t len=std::fread(pos+rest, 1, BUF_SIZE-rest, fin);
    *(endbuf = buf + (rest+len)) = 0;

    return *pos;
  }

  inline bool scan(char &in) {
    if ((in = *pos)) {
      ++pos;
      return true;
    }

    return rebuffer() && (in = *pos++);
  }

  inline bool scan(char *in) {
    if ((*in = *pos) == 0) {
      if (rebuffer() && (*in = *pos) == 0) {
        return false;
      }
    }
    ++in;
    while (true) {
      if ((*in = *pos++) == 0) {
        if (rebuffer() && (*in = *pos++) == 0) {
          return true;
        }
      }
      ++in;
    }
  }

  inline bool scan(double &in) {
    if (pos + FLT_LEN >= endbuf && !rebuffer()) {
      in = 0.0;
      return false;
    }

    char *tmp;
    in = std::strtod(pos, &tmp);
    pos = tmp;
    return true;
  }

  template <class Int>
  inline bool scan(Int &in) {
    in = 0;

    // assume that no redundant whitespace appears
    if (pos + INT_LEN >= endbuf && !rebuffer()) {
      return false;
    }

    if (std::is_signed<Int>::value) {
      if (*pos == '-') {
        in = ~*++pos+'1';
        while (*++pos >= '0') {
          in = in*10 + ~*pos+'1';
        }
        ++pos;
        return true;
      }
    }

    // assume that numbers are separated by the character whose value is
    // less than '0' (e.g. whitespaces, newlines)
    do {
      in = in*10 + *pos-'0';
    } while (*++pos >= '0');
    ++pos;
    return true;
  }

  inline bool eat() {
    if (*pos > ' ') {
      return true;
    }

    do {
      if (*pos == 0 && !rebuffer()) {
        return false;
      }
    } while (*++pos <= ' ');

    return true;
  }

  inline bool eat(char ch) {
    if (*pos == ch) {
      return !(*++pos == 0 && !rebuffer());
    }

    while (*pos != ch) {
      if (*pos == 0) {
        if (!rebuffer()) return false;
      } else {
        ++pos;
      }
    }

    return !(*++pos == 0 && !rebuffer());
  }

  class Scanner {
    bool rebuffer() {
      return FastIn::rebuffer();
    }

  public:
    Scanner(FILE *fin=stdin) {
      FastIn::fin = fin;
      endbuf = pos + std::fread(buf, 1, BUF_SIZE, fin);
    }

    template <class T>
    inline bool scan(T &in) {
      return FastIn::scan(in);
    }

    template <class First, class... Rest>
    inline bool scan(First &in, Rest &...ins) {
      return scan(in) && scan(ins...);
    }

    inline bool eat(char ch) {
      return FastIn::eat(ch);
    }
  };
}
FastIn::Scanner cin;

int main() {
  size_t N;
  cin.scan(N);

  intmax_t S[256]={};
  char c;
  while (cin.scan(c)) {
    ++S[c];  /* ignore [-Wchar-subscripts] */
    cin.eat('\n');
  }

  intmax_t res=0;
  res += S['M'] * S['A'] * S['R'];
  res += S['M'] * S['A'] * S['C'];
  res += S['M'] * S['A'] * S['H'];
  res += S['M'] * S['R'] * S['C'];
  res += S['M'] * S['R'] * S['H'];
  res += S['M'] * S['C'] * S['H'];
  res += S['A'] * S['R'] * S['C'];
  res += S['A'] * S['R'] * S['H'];
  res += S['A'] * S['C'] * S['H'];
  res += S['R'] * S['C'] * S['H'];

  printf("%jd\n", res);
}


#include <cstdio>
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <cstddef>
#include <cinttypes>

#include <type_traits>
#include <limits>

namespace FastIn {
  static constexpr size_t BUF_SIZE=1<<17, INT_LEN=24, FLT_LEN=400;
  static char buf[BUF_SIZE|1]={}, *pos=buf, *endbuf=nullptr;
  FILE *fin;

  inline bool rebuffer() {
    // returns true <=> there is at least one unread character
    size_t rest=endbuf-pos;
    if (buf+rest > pos) {
      // buf[:pos] and buf[-pos:] are overlapping, which std::memcpy()
      // causes undefined behavior.
      return true;
    }

    std::memcpy(buf, pos, rest);
    pos = buf;
    size_t len=std::fread(pos+rest, 1, BUF_SIZE-rest, fin);
    *(endbuf = buf + (rest+len)) = 0;

    return *pos;
  }

  inline bool scan(char &in) {
    if ((in = *pos)) {
      ++pos;
      return true;
    }

    return rebuffer() && (in = *pos++);
  }

  inline bool scan(char *in) {
    if ((*in = *pos) == 0) {
      if (rebuffer() && (*in = *pos) == 0) {
        return false;
      }
    }
    ++in;
    while (true) {
      if ((*in = *pos++) == 0) {
        if (rebuffer() && (*in = *pos++) == 0) {
          return true;
        }
      }
      ++in;
    }
  }

  inline bool scan(double &in) {
    if (pos + FLT_LEN >= endbuf && !rebuffer()) {
      in = 0.0;
      return false;
    }

    char *tmp;
    in = std::strtod(pos, &tmp);
    pos = tmp;
    return true;
  }

  template <class Int>
  inline bool scan(Int &in) {
    in = 0;

    // assume that no redundant whitespace appears
    if (pos + INT_LEN >= endbuf && !rebuffer()) {
      return false;
    }

    if (std::is_signed<Int>::value) {
      if (*pos == '-') {
        in = ~*++pos+'1';
        while (*++pos >= '0') {
          in = in*10 + ~*pos+'1';
        }
        ++pos;
        return true;
      }
    }

    // assume that numbers are separated by the character whose value is
    // less than '0' (e.g. whitespaces, newlines)
    do {
      in = in*10 + *pos-'0';
    } while (*++pos >= '0');
    ++pos;
    return true;
  }

  inline bool eat() {
    if (*pos > ' ') {
      return true;
    }

    do {
      if (*pos == 0 && !rebuffer()) {
        return false;
      }
    } while (*++pos <= ' ');

    return true;
  }

  inline bool eat(char ch) {
    if (*pos == ch) {
      return !(*++pos == 0 && !rebuffer());
    }

    while (*pos != ch) {
      if (*pos == 0) {
        if (!rebuffer()) return false;
      } else {
        ++pos;
      }
    }

    return !(*++pos == 0 && !rebuffer());
  }

  class Scanner {
    bool rebuffer() {
      return FastIn::rebuffer();
    }

  public:
    Scanner(FILE *fin=stdin) {
      FastIn::fin = fin;
      endbuf = pos + std::fread(buf, 1, BUF_SIZE, fin);
    }

    template <class T>
    inline bool scan(T &in) {
      return FastIn::scan(in);
    }

    template <class First, class... Rest>
    inline bool scan(First &in, Rest &...ins) {
      return scan(in) && scan(ins...);
    }

    inline bool eat(char ch) {
      return FastIn::eat(ch);
    }
  };
}
FastIn::Scanner cin;

int main() {
  size_t N;
  cin.scan(N);

  intmax_t S[256]={};
  for (size_t i=0; i<N; ++i) {
    char c;
    cin.scan(c);
    ++S[c];  /* ignore [-Wchar-subscripts] */
    cin.eat('\n');
  }

  intmax_t res=0;
  res += S['M'] * S['A'] * S['R'];
  res += S['M'] * S['A'] * S['C'];
  res += S['M'] * S['A'] * S['H'];
  res += S['M'] * S['R'] * S['C'];
  res += S['M'] * S['R'] * S['H'];
  res += S['M'] * S['C'] * S['H'];
  res += S['A'] * S['R'] * S['C'];
  res += S['A'] * S['R'] * S['H'];
  res += S['A'] * S['C'] * S['H'];
  res += S['R'] * S['C'] * S['H'];

  printf("%jd\n", res);
}


#include <bits/stdc++.h>

class kin{
public:
	inline void open(FILE *,int);
	inline void close(void);
	inline void scan(void);
	inline kin &operator>(char &);
	inline kin &operator>(int &);
	inline kin &operator>(long long &);
	inline kin &operator>(double &);
	inline kin &operator>(long double &);
	inline kin &operator>(char *);
	template<class T>
	inline void get(T *,int);
private:
	FILE *fp;
	char *buf;
	int siz;
	int idx;
}in;

class kout{
public:
	inline void open(FILE *,int);
	inline void close(void);
	inline void print(void);
	inline kout &operator<(char);
	inline kout &operator<(int);
	inline kout &operator<(long long);
	inline kout &operator<(double);
	inline kout &operator<(long double);
	inline kout &operator<(const char *);
	template<class T>
	inline void put(T *,int,char,char);
private:
	FILE *fp;
	char *buf;
	int siz;
	int idx;
}out;

int main(int argc,char **argv){
	in.open(stdin,512);
	out.open(stdout,512);
	in.scan();
	int n;
	in>n;
	int m=0,a=0,r=0,c=0,h=0;
	for(int i=0;i<n;++i){
		char s[11];
		in>s;
		if(s[0]=='M') ++m;
		else if(s[0]=='A') ++a;
		else if(s[0]=='R') ++r;
		else if(s[0]=='C') ++c;
		else if(s[0]=='H') ++h;
	}
	out<(long long)m*(long long)a*(long long)r+(long long)m*(long long)a*(long long)c+(long long)m*(long long)a*(long long)h+(long long)m*(long long)r*(long long)c+(long long)m*(long long)r*(long long)h+(long long)m*(long long)c*(long long)h+(long long)a*(long long)r*(long long)c+(long long)a*(long long)r*(long long)h+(long long)a*(long long)c*(long long)h+(long long)r*(long long)c*(long long)h<'\n';
	out.print();
	in.close();
	out.close();
	return 0;
}

inline void kin::open(FILE *fparg,int sizarg){
	fp=fparg;
	buf=new char[sizarg];
	siz=sizarg;
	idx=0;
	return;
}
inline void kin::close(void){
	fp=nullptr;
	delete[] buf;
	buf=nullptr;
	siz=0;
	idx=0;
	return;
}
inline void kin::scan(void){
	int readsiz=(int)std::fread((void *)buf,(std::size_t)1,(std::size_t)siz,fp);
	if(readsiz!=siz) buf[readsiz]='\x00';
	idx=0;
	return;
}
inline kin &kin::operator>(char &var){
	if(!buf[idx]){
		var='\x00';
		return *this;
	}
	var=buf[idx];
	if(++idx==siz) scan();
	if(++idx==siz) scan();
	return *this;
}
inline kin &kin::operator>(int &var){
	if(!buf[idx]){
		var=0;
		return *this;
	}
	int sign=-1;
	if(buf[idx]=='-'){
		sign=1;
		if(++idx==siz) scan();
	}
	var=0;
	while(buf[idx]>='0'){
		var=var*10-(int)(buf[idx]-'0');
		if(++idx==siz) scan();
	}
	var*=sign;
	if(++idx==siz) scan();
	return *this;
}
inline kin &kin::operator>(long long &var){
	if(!buf[idx]){
		var=0LL;
		return *this;
	}
	long long sign=-1LL;
	if(buf[idx]=='-'){
		sign=1LL;
		if(++idx==siz) scan();
	};
	var=0LL;
	while(buf[idx]>='0'){
		var=var*10LL-(long long)(buf[idx]-'0');
		if(++idx==siz) scan();
	}
	var*=sign;
	if(++idx==siz) scan();
	return *this;
}
inline kin &kin::operator>(double &var){
	if(!buf[idx]){
		var=0.0;
		return *this;
	}
	double sign=-1.0;
	if(buf[idx]=='-'){
		sign=1.0;
		if(++idx==siz) scan();
	}
	var=0.0;
	while(buf[idx]>='0'){
		var=var*10.0-(double)(buf[idx]-'0');
		if(++idx==siz) scan();
	}
	if(buf[idx]=='.'){
		if(++idx==siz) scan();
		double dig=1.0;
		while(buf[idx]>='0'){
			var-=(double)(buf[idx]-'0')*(dig/=10.0);
			if(++idx==siz) scan();
		}
	}
	var*=sign;
	if(++idx==siz) scan();
	return *this;
}
inline kin &kin::operator>(long double &var){
	if(!buf[idx]){
		var=0.0L;
		return *this;
	}
	long double sign=-1.0L;
	if(buf[idx]=='-'){
		sign=1.0L;
		if(++idx==siz) scan();
	}
	var=0.0L;
	while(buf[idx]>='0'){
		var=var*10.0L-(long double)(buf[idx]-'0');
		if(++idx==siz) scan();
	}
	if(buf[idx]=='.'){
		if(++idx==siz) scan();
		long double dig=1.0L;
		while(buf[idx]>='0'){
			var-=(long double)(buf[idx]-'0')*(dig/=10.0L);
			if(++idx==siz) scan();
		}
	}
	var*=sign;
	if(++idx==siz) scan();
	return *this;
}
inline kin &kin::operator>(char *str){
	if(!buf[idx]){
		str[0]='\x00';
		return *this;
	}
	int ptr=0;
	while(buf[idx]>='!'){
		str[ptr++]=buf[idx];
		if(++idx==siz) scan();
	}
	str[ptr]='\x00';
	if(++idx==siz) scan();
	return *this;
}
template<class T>
inline void kin::get(T *arr,int num){
	for(int i=0;i<num;++i) (*this)>arr[i];
	return;
}

inline void kout::open(FILE *fparg,int sizarg){
	fp=fparg;
	buf=new char[sizarg];
	siz=sizarg;
	idx=0;
	return;
}
inline void kout::close(void){
	fp=nullptr;
	delete[] buf;
	buf=nullptr;
	siz=0;
	idx=0;
	return;
}
inline void kout::print(void){
	std::fwrite((void *)buf,(std::size_t)1,(std::size_t)idx,fp);
	idx=0;
	return;
}
inline kout &kout::operator<(char val){
	buf[idx]=val;
	if(++idx==siz) print();
	return *this;
}
inline kout &kout::operator<(int val){
	if(val<0){
		buf[idx]='-';
		if(++idx==siz) print();
	}
	else val*=-1;
	char dig[10];
	int ptr=0;
	do{
		int tmp=val/10;
		dig[ptr++]=(char)-(val-tmp*10)+'0';
		val=tmp;
	}while(val);
	while(ptr--){
		buf[idx]=dig[ptr];
		if(++idx==siz) print();
	}
	return *this;
}
inline kout &kout::operator<(long long val){
	if(val<0LL){
		buf[idx]='-';
		if(++idx==siz) print();
	}
	else val*=-1LL;
	char dig[19];
	int ptr=0;
	do{
		long long tmp=val/10LL;
		dig[ptr++]=(char)-(val-tmp*10LL)+'0';
		val=tmp;
	}while(val);
	while(ptr--){
		buf[idx]=dig[ptr];
		if(++idx==siz) print();
	}
	return *this;
}
inline kout &kout::operator<(double val){
	if(val<0.0){
		buf[idx]='-';
		if(++idx==siz) print();
	}
	else val*=-1.0;
	double dig=1.0;
	while(val/dig<=-10.0) dig*=10.0;
	int tmp;
	while(dig>=1.0){
		buf[idx]=(char)-(tmp=(int)(val/dig))+'0';
		if(++idx==siz) print();
		val-=(double)tmp*dig;
		dig/=10.0;
	}
	buf[idx]='.';
	if(++idx==siz) print();
	for(int i=0;i<12;++i){
		buf[idx]=(char)-(tmp=(int)(val/dig))+'0';
		if(++idx==siz) print();
		val-=(double)tmp*dig;
		dig/=10.0;
	}
	return *this;
}
inline kout &kout::operator<(long double val){
	if(val<0.0L){
		buf[idx]='-';
		if(++idx==siz) print();
	}
	else val*=-1.0L;
	long double dig=1.0L;
	while(val/dig<=-10.0L) dig*=10.0L;
	int tmp;
	while(dig>=1.0L){
		buf[idx]=(char)-(tmp=(int)(val/dig))+'0';
		if(++idx==siz) print();
		val-=(long double)tmp*dig;
		dig/=10.0L;
	}
	buf[idx]='.';
	if(++idx==siz) print();
	for(int i=0;i<16;++i){
		buf[idx]=(char)-(tmp=(int)(val/dig))+'0';
		if(++idx==siz) print();
		val-=(long double)tmp*dig;
		dig/=10.0L;
	}
	return *this;
}
inline kout &kout::operator<(const char *str){
	for(int i=0;str[i];++i){
		buf[idx]=str[i];
		if(++idx==siz) print();
	}
	return *this;
}
template<class T>
inline void kout::put(T *arr,int num,char dlm,char end){
	--num;
	for(int i=0;i<num;++i) (*this)<arr[i]<dlm;
	(*this)<arr[num]<end;
	return;
}


#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';
}


#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';
}


#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';
}


#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;
}


#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;
}


#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;
}


#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;
}


#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;
}


#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;
}


// 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"));