public static int arithmicSequences(int[]A) {
		int c=0,rel=0;
		for (int i=1,n=A.length,p=n<1?0:A[1]-A[0];i<n;++i)
			if (A[i]-A[i-1]==p) ++c;
			else {
				rel+=c*(c-1)/2;
				c=1;p=A[i]-A[i-1];
			}
		return rel+(c>1?c*(c-1)/2:0);
	}