#include <iostream>
#include <cstdint>

using namespace std;

const int32_t N = 10;
static_assert(N > 3, "N should be greater than 3");

const int32_t c_limit = 3 * (1 << (N-2)) - 1;

template<size_t s>
int32_t shr(int32_t n) { return n >> s; }

bool cond_1(const int32_t u, const int32_t v)  { return (-1         + shr<8>(u)) == (-shr<3>(v) + shr<2>(v)); }
bool cond_2(const int32_t u, const int32_t v)  { return ( shr<8>(u) - shr<7>(u)) == ( shr<4>(v) - shr<3>(v)); }
bool cond_3(const int32_t u, const int32_t v)  { return (-shr<7>(u) + shr<6>(u)) == (-shr<5>(v) + shr<4>(v)); }
bool cond_4(const int32_t u, const int32_t v)  { return ( shr<6>(u) - shr<5>(u)) == ( 1         - shr<8>(v)); }
bool cond_5(const int32_t u, const int32_t v)  { return (-shr<5>(u) + shr<4>(u)) == ( 1         - shr<0>(v)); }
bool cond_6(const int32_t u, const int32_t v)  { return ( shr<4>(u) - shr<3>(u)) == ( shr<8>(v) + shr<7>(v)); }
bool cond_7(const int32_t u, const int32_t v)  { return (-shr<3>(u) + shr<2>(u)) == (-shr<7>(v) + shr<6>(v)); }
bool cond_8(const int32_t u, const int32_t v)  { return ( shr<2>(u) - shr<1>(u)) == (-shr<1>(v) + shr<0>(v)); }
bool cond_9(const int32_t u, const int32_t v)  { return (-shr<1>(u) + shr<0>(u)) == ( shr<2>(v) - shr<1>(v)); }
bool cond_10(const int32_t u, const int32_t v) { return (-shr<0>(u) + 1)         == ( shr<6>(v) - shr<5>(v)); }

int main()
{
   size_t count = 0;
   for (int32_t u = 767; u <= c_limit; ++u)
   {
      for (int32_t v = 767; v <= c_limit; ++v)
      {
         if (cond_1(u, v) && cond_2(u, v) && cond_3(u, v) && cond_4(u, v) && cond_5(u, v) &&
             cond_6(u, v) && cond_7(u, v) && cond_8(u, v) && cond_9(u, v) && cond_10(u, v))
         {
            cout << "(" << u << ", " << v << ")" << endl;
            count++;
         }
      }
   }

   cout << count << " pairs" << endl;

   return 0;
}