function worth(arr) {
  var counts=[];
  for (var i=0; i<10; i++) counts[i]=0;
  for (var i=0; i<5; i++) {
    var cn=arr[i];
    if (cn>0) counts[cn]++;
  }
  Sort(counts);
  if (counts[9]==5) return 20;
  if (counts[9]==4) return 12;
  if (counts[9]==3) {
    if (counts[8]==2) return 8; else return 5;
  }
  if (counts[9]==2) {
    if (counts[8]==2) return 2; else return 1;
  }
  return 0;
}