import java.io.BufferedReader; import java.io.InputStreamReader; 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(" "); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = Long.parseLong(sa[i]); } br.close(); long ans = 0; long now = 0; int l = 0; for (int r = 0; r < n; r++) { now = gcd(now, a[r]); if (now == 1) { long now2 = a[r]; for (int k = r; k >= l; k--) { long next = gcd(now2, a[k]); if (next == 1) { ans += (long) (n - r) * (k - l + 1); l = k + 1; if (l > r) { now = 0; } else { now = now2; } break; } now2 = next; } } } System.out.println(ans); } static long gcd(long a, long b) { if (b == 0) { return a; } else { return gcd(b, a % b); } } }