import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.NoSuchElementException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Egor Kulikov (egor@egork.net) */ public class Solution { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); BreakingSticks solver = new BreakingSticks(); solver.solve(1, in, out); out.close(); } static class BreakingSticks { public void solve(int testNumber, InputReader in, OutputWriter out) { int n = in.readInt(); long[] a = IOUtils.readLongArray(in, n); long answer = 0; for (long i : a) { LongList divisors = new LongArrayList(); for (long j = 2; j * j <= i; j++) { while (i % j == 0) { i /= j; divisors.add(j); } } if (i != 1) { divisors.add(i); } long c = 1; for (int j = divisors.size() - 1; j >= 0; j--) { answer += c; c *= divisors.get(j); } answer += c; } out.printLine(answer); } } static abstract class LongAbstractStream implements LongStream { public String toString() { StringBuilder builder = new StringBuilder(); boolean first = true; for (LongIterator it = longIterator(); it.isValid(); it.advance()) { if (first) { first = false; } else { builder.append(' '); } builder.append(it.value()); } return builder.toString(); } public boolean equals(Object o) { if (!(o instanceof LongStream)) { return false; } LongStream c = (LongStream) o; LongIterator it = longIterator(); LongIterator jt = c.longIterator(); while (it.isValid() && jt.isValid()) { if (it.value() != jt.value()) { return false; } it.advance(); jt.advance(); } return !it.isValid() && !jt.isValid(); } public int hashCode() { int result = 0; for (LongIterator it = longIterator(); it.isValid(); it.advance()) { result *= 31; result += it.value(); } return result; } } static interface LongReversableCollection extends LongCollection { } static interface LongIterator { public long value() throws NoSuchElementException; public boolean advance(); public boolean isValid(); } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private InputReader.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 readInt() { 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 readLong() { 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 boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } static interface LongList extends LongReversableCollection { public abstract long get(int index); public abstract void addAt(int index, long value); public abstract void removeAt(int index); default public LongIterator longIterator() { return new LongIterator() { private int at; private boolean removed; public long value() { if (removed) { throw new IllegalStateException(); } return get(at); } public boolean advance() { at++; removed = false; return isValid(); } public boolean isValid() { return !removed && at < size(); } public void remove() { removeAt(at); at--; removed = true; } }; } default public void add(long value) { addAt(size(), value); } } static class LongArrayList extends LongAbstractStream implements LongList { private int size; private long[] data; public LongArrayList() { this(3); } public LongArrayList(int capacity) { data = new long[capacity]; } public LongArrayList(LongCollection c) { this(c.size()); addAll(c); } public LongArrayList(LongStream c) { this(); if (c instanceof LongCollection) { ensureCapacity(((LongCollection) c).size()); } addAll(c); } public LongArrayList(LongArrayList c) { size = c.size(); data = c.data.clone(); } public LongArrayList(long[] arr) { size = arr.length; data = arr.clone(); } public int size() { return size; } public long get(int at) { if (at >= size) { throw new IndexOutOfBoundsException("at = " + at + ", size = " + size); } return data[at]; } private void ensureCapacity(int capacity) { if (data.length >= capacity) { return; } capacity = Math.max(2 * data.length, capacity); data = Arrays.copyOf(data, capacity); } public void addAt(int index, long value) { ensureCapacity(size + 1); if (index > size || index < 0) { throw new IndexOutOfBoundsException("at = " + index + ", size = " + size); } if (index != size) { System.arraycopy(data, index, data, index + 1, size - index); } data[index] = value; size++; } public void removeAt(int index) { if (index >= size || index < 0) { throw new IndexOutOfBoundsException("at = " + index + ", size = " + size); } if (index != size - 1) { System.arraycopy(data, index + 1, data, index, size - index - 1); } size--; } } static class IOUtils { public static long[] readLongArray(InputReader in, int size) { long[] array = new long[size]; for (int i = 0; i < size; i++) { array[i] = in.readLong(); } return array; } } 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 close() { writer.close(); } public void printLine(long i) { writer.println(i); } } static interface LongCollection extends LongStream { public int size(); default public void add(long value) { throw new UnsupportedOperationException(); } default public LongCollection addAll(LongStream values) { for (LongIterator it = values.longIterator(); it.isValid(); it.advance()) { add(it.value()); } return this; } } static interface LongStream extends Iterable, Comparable { public LongIterator longIterator(); default public Iterator iterator() { return new Iterator() { private LongIterator it = longIterator(); public boolean hasNext() { return it.isValid(); } public Long next() { long result = it.value(); it.advance(); return result; } }; } default public int compareTo(LongStream c) { LongIterator it = longIterator(); LongIterator jt = c.longIterator(); while (it.isValid() && jt.isValid()) { long i = it.value(); long j = jt.value(); if (i < j) { return -1; } else if (i > j) { return 1; } it.advance(); jt.advance(); } if (it.isValid()) { return 1; } if (jt.isValid()) { return -1; } return 0; } } }