Papazol,
var source =
[
[743,434],
[743,968],
[310,968],
[262,434],
[695,677],
[695,274],
[145,274],
[695,174],
[743,871],
[145,532],
[922,677],
[485,677],
[821,729],
[743,336],
[111,274],
[588,729],
[743,274],
[695,968],
[695,677],
[821,174],
[111,871],
[821,871],
[145,968],
[922,968],
[588,729],
[111,532]
]
function freqPairs(b) {
for (var c = {}, a = 0; a < b.length; a++) {
var d = b[a];
c[d] ? c[d]++ : c[d] = 1
}
b.sort(function (a, b) {
return c[b] - c[a] || b[0] - a[0] || b[1] - a[1]
});
for (a = 0; a < b.length; a++) b[a][2] = c[b[a]];
return b
};
alert(freqPairs( source ).join('\n'));