import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigInteger; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] sa = br.readLine().split(" "); BigInteger[] a = new BigInteger[n]; for (int i = 0; i < n; i++) { a[i] = new BigInteger(sa[i]); } br.close(); long ans = 0; BigInteger now = BigInteger.ZERO; int l = 0; for (int r = 0; r < n; r++) { now = now.gcd(a[r]); if (now.compareTo(BigInteger.ONE) == 0) { BigInteger now2 = a[r]; for (int k = r; k >= l; k--) { BigInteger next = now2.gcd(a[k]); if (next.compareTo(BigInteger.ONE) == 0) { ans += (long) (n - r) * (k - l + 1); l = k + 1; if (l > r) { now = BigInteger.ZERO; } else { now = now2; } break; } now2 = next; } } } System.out.println(ans); } }