use std::io::Write;
use std::collections::HashMap;

fn main() {
    let mut scanner = utils::StdinScanner::new();
    let mut writer = utils::StdoutWriter::new();

    let n: usize = scanner.read();

    let a: Vec<usize> = scanner.read_vec(n);
    let mut counts = HashMap::<usize, u64>::new();

    for ai in &a {
        *counts.entry(*ai).or_insert(0) += 1;
    }

    let sum: u64 = counts.values().map(|v| v * (v - 1) / 2).sum();

    for ai in &a {
        let count = counts[ai];
        writeln!(writer, "{}", sum - count + 1).unwrap();
    }
}

#[allow(dead_code)]
mod utils {
    use std::io::{self, BufRead, BufReader, Stdin, StdinLock, Write};
    use std::mem;
    use std::ops::{Deref, DerefMut};
    use std::str::{self, FromStr};

    pub struct Scanner<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> Scanner<R> {
        pub fn new(reader: R) -> Scanner<R> {
            Scanner {
                reader: reader,
                buf: Vec::new(),
            }
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_until(|&b| b == b' ' || b == b'\n');
            self.parse()
        }

        pub fn reads(&mut self) -> &str {
            self.read_until(|&b| b == b' ' || b == b'\n');
            unsafe { str::from_utf8_unchecked(&self.buf) }
        }

        pub fn readl(&mut self) -> &str {
            self.buf.clear();
            self.reader.read_until(b'\n', &mut self.buf).unwrap();
            let bytes = if self.buf.last() == Some(&b'\n') {
                &self.buf[..self.buf.len() - 1]
            } else {
                &self.buf
            };
            unsafe { str::from_utf8_unchecked(&bytes) }
        }

        pub fn read_vec<T: FromStr>(&mut self, count: usize) -> Vec<T> {
            (0..count).map(|_| self.read()).collect()
        }

        fn read_until<P: FnMut(&u8) -> bool>(&mut self, mut predicate: P) {
            self.buf.clear();
            let mut first = true;

            // https://doc.rust-lang.org/src/std/io/mod.rs.html#1623-1649
            loop {
                let (done, used) = {
                    let available = self.reader.fill_buf().unwrap();
                    if first && available.len() == 0 {
                        panic!("Scan Error (EOF reached)");
                    }

                    match available.iter().position(&mut predicate) {
                        Some(0) if first => {
                            (false, 1)
                        }
                        Some(i) => {
                            self.buf.extend_from_slice(&available[..i]);
                            (true, i + 1)
                        }
                        None => {
                            self.buf.extend_from_slice(available);
                            (false, available.len())
                        }
                    }
                };

                self.reader.consume(used);
                if done || used == 0 {
                    return;
                }

                first = false;
            }
        }

        #[inline]
        fn parse<T: FromStr>(&mut self) -> T {
            // 文字列をT型へパースする
            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse()
                .unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
        }
    }

    pub struct StdinScanner {
        stdin: Stdin,
        scanner: Scanner<BufReader<StdinLock<'static>>>,
    }

    impl StdinScanner {
        pub fn new() -> StdinScanner {
            let stdin = io::stdin();
            let stdinlock = unsafe { mem::transmute(stdin.lock()) };
            let reader = BufReader::with_capacity(4096, stdinlock);
            let scanner = Scanner::new(reader);
            StdinScanner {
                stdin: stdin,
                scanner: scanner,
            }
        }
    }

    impl Deref for StdinScanner {
        type Target = Scanner<BufReader<StdinLock<'static>>>;

        #[inline]
        fn deref(&self) -> &Self::Target {
            &self.scanner
        }
    }

    impl DerefMut for StdinScanner {
        #[inline]
        fn deref_mut(&mut self) -> &mut Self::Target {
            &mut self.scanner
        }
    }

    pub struct StdoutWriter {
        buf: Vec<u8>,
    }

    impl StdoutWriter {
        pub fn new() -> StdoutWriter {
            StdoutWriter {
                buf: Vec::with_capacity(4096)
            }
        }
    }

    impl Drop for StdoutWriter {
        fn drop(&mut self) {
            self.flush().unwrap();
        }
    }

    impl Write for StdoutWriter {
        fn flush(&mut self) -> io::Result<()> {
            io::stdout().write_all(&self.buf)
        }

        fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
            self.buf.extend_from_slice(buf);
            Ok(buf.len())
        }

        fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
            self.buf.extend_from_slice(buf);
            Ok(())
        }
    }
}


Measured memory_bytes: 17176