PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000025. Xóa hết dãy theo điều kiện chia hết (Di-visible Confusion)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Xóa hết dãy theo điều kiện chia hết (Di-visible Confusion)

Di-visible Confusion

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer array, you may delete an element at its current one-based position ii only when its value is not divisible by i+1i+1. The remaining elements close the gap and indices change. Determine whether the entire array can be deleted.

Input

First line nn; second line nn elements aia_i.

Output

Print YES if possible, otherwise NO.

Subtasks

  • Subtask 1 (20 points): 1≤n≤101 \le n \le 10; 1≤ai≤1001 \le a_i \le 100
  • Subtask 2 (30 points): 1≤n≤10001 \le n \le 1000; 1≤ai≤1061 \le a_i \le 10^{6}
  • Subtask 3 (50 points): 1≤n≤1051 \le n \le 10^{5}; 1≤ai≤1091 \le a_i \le 10^{9}

Examples

Input

3
1 2 3

Output

YES

Explanation

Delete the element 22 at index 22 (not divisible by 33), then delete 11 at index 11, and finally the remaining 33.