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

#GL0000127. Hossam và các học viên (Hossam and Trainees)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Hossam và các học viên (Hossam and Trainees)

Hossam and Trainees

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn trainees with positive integer labels aia_i. A pair of trainees at distinct indices is successful if some integer x≥2x\ge2 divides both labels. Determine whether at least one successful pair exists.

Input

The first line contains nn; the next contains nn integers aia_i.

Output

Print YES if a successful pair exists; otherwise print NO.

Subtasks

  • Subtask 1 (20 points): 2≤n≤202\le n\le 20; 1≤ai≤1001\le a_i\le 100.
  • Subtask 2 (30 points): 2≤n≤1 0002\le n\le 1\,000; 1≤ai≤100 0001\le a_i\le 100\,000.
  • Subtask 3 (50 points): 2≤n≤100 0002\le n\le 100\,000; 1≤ai≤1 000 000 0001\le a_i\le 1\,000\,000\,000.

Examples

Input

3
32 48 7

Output

YES

Explanation

Both 32 and 48 are divisible by 2 (also by 16), so a successful pair exists, regardless of 7.