+#!/usr/bin/perl -w
+
+use v5.16;
+
+my ($c, @s);
+
+chomp (my @nums = <>);
+$c = @nums;
+
+my @n = @nums;
+my $pos = 0;
+while (@n > 1) {
+ my $ones = grep { substr ($_, $pos, 1) eq '1' } @n;
+ if ($ones >= @n/2) {
+ @n = grep { substr ($_, $pos, 1) eq '1' } @n;
+ } else {
+ @n = grep { substr ($_, $pos, 1) eq '0' } @n;
+ }
+ $pos++;
+}
+my $ox = oct "0b".$n[0];
+
+@n = @nums;
+$pos = 0;
+while (@n > 1) {
+ my $ones = grep { substr ($_, $pos, 1) eq '0' } @n;
+ if ($ones > @n/2) {
+ @n = grep { substr ($_, $pos, 1) eq '1' } @n;
+ } else {
+ @n = grep { substr ($_, $pos, 1) eq '0' } @n;
+ }
+ $pos++;
+}
+my $co = oct "0b".$n[0];
+
+say $ox * $co;
+