// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!();
    let mut xs = vec![];
    for _ in 0..n {
    	let x = get!();
        xs.push(x);
    }
    let mut ans = 0;
    for p in 1..20000000 {
        let mut m = 0;
        for &x in xs.iter() {
        	m += p % x;
        }
        if m > ans {
        	ans = m;
        }
    }
    println!("{}", ans);
}
