t = Compile[{{n, _Integer}}, Module[{s = 0},
(Do[If[w + x == Abs[x - y] + Abs[y - z], s = s + 1],
{w, 1, #}, {x, 1, #}, {y, 1, #}, {z, 1, #}] &[n]; s)]];
Map[t[#] &, Range[0, 40]] (*
A212676 *)
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {0, 0, 1, 9, 23, 52}, 41]