#include<iostream>
#include<cmath>
using namespace std;
class base
{
    public:
    virtual int check(double n){return 0;}
};
class IntCheck:public base
{
    public:
    int check(double n) override
    {
        int v=(int)n;
        return (pow((v/100)+(v%100),2)==v);
    }
};
int main()
{
    int type, num;
    if(!(cin>>type)) return 0;
    if(type !=1 && type !=2)
    {
        cout<<"-1"; return 0;}
        if(!(cin>>num)){cout<<"Invalid input"; return 0;
    }
    IntChekc obj;
    cout<<obj.check(num);
    return 0;
}