Codeforces Round #201 (Div. 1)/346A Alice and Bob: Number theory & Idea questions

Source: Internet
Author: User
Tags time limit

A. Alice and Bob

Http://codeforces.com/problemset/problem/346/A

Time limit per test

2 seconds

Memory limit per test

256 Megabytes

Input

Standard input

Output

Standard output

It is so boring in the summer holiday, isn ' t it? So Alice and Bob have invented a new game. The rules are as follows. The They get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Alice or Bob (the player whose turn are the current) can choose two distinct integers x a nd y from the set, such this set doesn ' t contain their absolute difference | x-y|. Then this player adds integer | x-y| To the set (so, the size of the set increases by one).

If The current player has no valid move, he (or she) loses the game. The question is who would finally win the game if both players play optimally. Remember that Alice always moves.

Input

The "The" contains an integer n (2≤n≤100)-the Initial number of elements in the set. The second line contains n distinct space-separated integers a1,a2,..., a n (1≤ai≤109)-the elements of the set.

Output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.