public static int syLegendre(long a, long n) {
		if(a%n==0) {
			return 0;
		}
		else {
			long p=a%n;
			if((double)((int)Math.sqrt(p))==Math.sqrt(p)) {
				return 1;				
			}
			else {
				return -1;
			}
		}
	}