% © Evan Chen
% Downloaded from https://web.evanchen.cc/

\documentclass[11pt]{scrartcl}
\usepackage[sexy]{evan}
\ihead{\footnotesize\textbf{\thetitle}}
\ohead{\footnotesize\href{http://web.evanchen.cc}{\ttfamily web.evanchen.cc},
    updated \today}
\title{JMO 2017 Solution Notes}
\date{\today}

\begin{document}

\maketitle

\begin{abstract}
This is a compilation of solutions
for the 2017 JMO.
The ideas of the solution are a mix of my own work,
the solutions provided by the competition organizers,
and solutions found by the community.
However, all the writing is maintained by me.

These notes will tend to be a bit more advanced and terse than the ``official''
solutions from the organizers.
In particular, if a theorem or technique is not known to beginners
but is still considered ``standard'', then I often prefer to
use this theory anyways, rather than try to work around or conceal it.
For example, in geometry problems I typically use directed angles
without further comment, rather than awkwardly work around configuration issues.
Similarly, sentences like ``let $\mathbb{R}$ denote the set of real numbers''
are typically omitted entirely.

Corrections and comments are welcome!
\end{abstract}

\tableofcontents
\newpage

\addtocounter{section}{-1}
\section{Problems}
\begin{enumerate}[\bfseries 1.]
\item %% Problem 1
Prove that there exist infinitely many pairs of
relatively prime positive integers $a,b > 1$
for which $a+b$ divides $a^b+b^a$.

\item %% Problem 2
Show that the Diophantine equation
\[ \left( 3x^3+xy^2 \right)\left( x^2y+3y^3 \right) = (x-y)^7 \]
has infinitely many solutions in positive integers,
and characterize all the solutions.

\item %% Problem 3
Let $ABC$ be an equilateral triangle and $P$ a point on its circumcircle.
Set $D = \ol{PA} \cap \ol{BC}$, $E = \ol{PB} \cap \ol{CA}$, $F = \ol{PC} \cap \ol{AB}$.
Prove that the area of triangle $DEF$ is twice the area of triangle $ABC$.

\item %% Problem 4
Are there any triples $(a,b,c)$ of positive integers such that
$(a-2)(b-2)(c-2)+12$ is a prime number
that properly divides the positive number
$a^2+b^2+c^2+abc-2017$?

\item %% Problem 5
Let $O$ and $H$ be the circumcenter
and the orthocenter of an acute triangle $ABC$.
Points $M$ and $D$ lie on side $BC$
such that $BM=CM$ and $\angle BAD = \angle CAD$.
Ray $MO$ intersects the circumcircle of triangle $BHC$ in point $N$.
Prove that $\angle ADO = \angle HAN$.

\item %% Problem 6
Let $P_1$, $P_2$, \dots, $P_{2n}$ be $2n$ distinct points on the
unit circle $x^2+y^2=1$, other than $(1,0)$.
Each point is colored either red or blue,
with exactly $n$ red points and $n$ blue points.
Let $R_1$, $R_2$, \dots, $R_n$ be any ordering of the red points.
Let $B_1$ be the nearest blue point to $R_1$ traveling
counterclockwise around the circle starting from $R_1$.
Then let $B_2$ be the nearest of the remaining blue points to $R_2$
travelling counterclockwise around the circle from $R_2$, and so on,
until we have labeled all of the blue points $B_1$, \dots, $B_n$.
Show that the number of counterclockwise arcs of the form $R_i \to B_i$
that contain the point $(1,0)$ is independent of the way we chose the
ordering $R_1$, \dots, $R_n$ of the red points.

\end{enumerate}
\pagebreak

\section{Solutions to Day 1}
\subsection{JMO 2017/1, proposed by Gregory Galperin}
\textsl{Available online at \url{https://aops.com/community/p8108366}.}
\begin{mdframed}[style=mdpurplebox,frametitle={Problem statement}]
Prove that there exist infinitely many pairs of
relatively prime positive integers $a,b > 1$
for which $a+b$ divides $a^b+b^a$.
\end{mdframed}
One construction: let $d \equiv 1 \pmod 4$, $d > 1$.
Let $x = \frac{d^d+2^d}{d+2}$. Then set
\[ a = \frac{x+d}{2}, \qquad
  b = \frac{x-d}{2}. \]
To see this works, first check that $b$ is odd and $a$ is even.
Let $d = a-b$ be odd.
Then:
\begin{align*}
  a+b \mid a^b+b^a &\iff
  (-b)^b + b^a \equiv 0 \pmod{a+b} \\
  &\iff b^{a-b} \equiv 1 \pmod{a+b} \\
  &\iff b^d \equiv 1 \pmod{d+2b} \\
  &\iff (-2)^d \equiv d^d \pmod{d+2b} \\
  &\iff d+2b \mid d^d + 2^d.
\end{align*}
So it would be enough that
\[ d+2b = \frac{d^d+2^d}{d+2}
  \implies b = \half \left( \frac{d^d+2^d}{d+2} - d \right) \]
which is what we constructed.
Also, since $\gcd(x,d) = 1$ it follows $\gcd(a,b) = \gcd(d,b) = 1$.

\begin{remark*}
  Ryan Kim points out that in fact,
  $(a,b) = (2n-1,2n+1)$ is always a solution.
\end{remark*}
\pagebreak

\subsection{JMO 2017/2, proposed by Titu Andreescu}
\textsl{Available online at \url{https://aops.com/community/p8108503}.}
\begin{mdframed}[style=mdpurplebox,frametitle={Problem statement}]
Show that the Diophantine equation
\[ \left( 3x^3+xy^2 \right)\left( x^2y+3y^3 \right) = (x-y)^7 \]
has infinitely many solutions in positive integers,
and characterize all the solutions.
\end{mdframed}
Let $x=da$, $y=db$, where $\gcd(a,b) = 1$ and $a > b$.
The equation is equivalent to
\[ (a-b)^7 \mid ab\left( a^2+3b^2 \right)\left( 3a^2+b^2 \right)
  \qquad (\star) \]
with the ratio of the two becoming $d$.

\begin{claim*}
  The equation $(\star)$ holds if and only if $a-b=1$.
\end{claim*}
\begin{proof}
  Obviously if $a-b=1$ then $(\star)$ is true.
  Conversely, suppose $(\star)$ holds.
  \begin{itemize}
    \ii If $a$ and $b$ are both odd, then $a^2+3b^2  \equiv 4 \pmod 8$.
    Similarly $3a^2+b^2 \equiv 4 \pmod 8$.
    Hence $2^4$ exactly divides right-hand side, contradiction.
    \ii Now suppose $a-b$ is odd.
    We have $\gcd(a-b,a) = \gcd(a-b,b) = 1$ by Euclid, but also
    \[ \gcd(a-b, a^2+3b^2) = \gcd(a-b, 4b^2) = 1 \]
    and similarly $\gcd(a-b, 3a^2+b^2) = 1$.
    Thus $a-b$ is coprime to each of $a$, $b$,
    $a^2+3b^2$, $3a^2+b^2$ and this forces $a-b = 1$.
  \end{itemize}
\end{proof}
This therefore describes all solutions: namely,
for any $b \ge 1$, if we set $a = b+1$ and $d = ab(a^2+3b^2)(3a^2+b)$
then $(x,y) = (da,db)$ works and any solution is of this form.

\begin{remark*}
  One can give different cosmetic representations of the same solution set.
  For example, we could write $b = \half (n-1)$
  and $a = \half (n+1)$ with $n > 1$ any \emph{odd} integer.
  Then $d = ab(a^2+3b^2)(3a^2+b^2) =
  \frac{(n-1)(n+1)(n^2+n+1)(n^2-n+1)}{4} = \frac{n^6-1}{4}$,
  and hence the solution is
  \[ (x,y) = (da, db) = \left( \frac{(n+1)(n^6-1)}{8},
    \frac{(n-1)(n^6-1)}{8} \right) \]
  which is a little simpler to write.
  The smallest solutions are $(364,182)$, $(11718, 7812)$, \dots.
\end{remark*}
\pagebreak

\subsection{JMO 2017/3, proposed by Titu Andreescu, Luis Gonzalez, Cosmin Pohoata}
\textsl{Available online at \url{https://aops.com/community/p8108450}.}
\begin{mdframed}[style=mdpurplebox,frametitle={Problem statement}]
Let $ABC$ be an equilateral triangle and $P$ a point on its circumcircle.
Set $D = \ol{PA} \cap \ol{BC}$, $E = \ol{PB} \cap \ol{CA}$, $F = \ol{PC} \cap \ol{AB}$.
Prove that the area of triangle $DEF$ is twice the area of triangle $ABC$.
\end{mdframed}
\paragraph{First solution (barycentric).}
We invoke barycentric coordinates on $ABC$.
Let $P = (u:v:w)$, with $uv+vw+wu = 0$ (circumcircle equation with $a=b=c$).
Then $D = (0:v:w)$, $E = (u:0:w)$, $F = (u:v:0)$.
Hence
\begin{align*}
  \frac{[DEF]}{[ABC]}
  &= \frac{1}{(u+v)(v+w)(w+u)}
  \det
  \begin{bmatrix}
    0 & v & w \\
    u & 0 & w \\
    u & v & 0
  \end{bmatrix}
  \\
  &= \frac{2uvw}{(u+v)(v+w)(w+u)} \\
  &= \frac{2uvw}{(u+v+w)(uv+vw+wu)-uvw} \\
  &= \frac{2uvw}{-uvw} = -2
\end{align*}
as desired (areas signed).

\paragraph{Second solution (``nice'' lengths).}
WLOG $ABPC$ is convex.
Let $x = AB = BC = CA$.
By Ptolemy's theorem and strong Ptolemy,
\begin{align*}
  PA &= PB + PC \\
  PA^2 &= PB \cdot PC + AB \cdot AC = PB \cdot PC + x^2 \\
  \implies x^2 &+ PB^2 + PB \cdot PC + PC^2.
\end{align*}
Also, $PD \cdot PA = PB \cdot PC$ and similarly
since $\ol{PA}$ bisects $\angle BPC$ (causing $\triangle BPD \sim \triangle APC$).

Now $P$ is the Fermat point of $\triangle DEF$,
since $\angle DPF = \angle FPE = \angle EPD = 120\dg$. Thus
\begin{align*}
  [DEF] &= \frac{\sqrt3}{4} \sum_{\text{cyc}} PE \cdot PF \\
  &= \frac{\sqrt3}{4} \sum_{\text{cyc}}
  \left( \frac{PA \cdot PC}{PB} \right)
  \left( \frac{PA \cdot PB}{PC} \right) \\
  &= \frac{\sqrt3}{4} \sum_{\text{cyc}} PA^2 \\
  &= \frac{\sqrt3}{4} \left( (PB+PC)^2 + PB^2 + PC^2 \right) \\
  &= \frac{\sqrt3}{4} \cdot 2x^2 = 2[ABC].
\end{align*}
\pagebreak

\section{Solutions to Day 2}
\subsection{JMO 2017/4, proposed by Titu Andreescu}
\textsl{Available online at \url{https://aops.com/community/p8117256}.}
\begin{mdframed}[style=mdpurplebox,frametitle={Problem statement}]
Are there any triples $(a,b,c)$ of positive integers such that
$(a-2)(b-2)(c-2)+12$ is a prime number
that properly divides the positive number
$a^2+b^2+c^2+abc-2017$?
\end{mdframed}
No such $(a,b,c)$.

Assume not.
Let $x=a-2$, $y=b-2$, $z=c-2$, hence $x,y,z \ge -1$.
\begin{align*}
  a^2+b^2+c^2+abc-2017
  &= (x+2)^2 + (y+2)^2 + (z+2)^2 \\ &
  + (x+2)(y+2)(z+2) - 2017 \\
  &= (x+y+z+4)^2 + (xyz+12) - 45^2.
\end{align*}
Thus the divisibility relation becomes
\[ p = xyz+12 \mid \left( x+y+z+4 \right)^2 - 45^2 > 0 \]
so either
\begin{align*}
  p &= xyz+12 \mid x+y+z-41 \\
  p &= xyz+12 \mid x+y+z+49
\end{align*}

Assume $x \ge y \ge z$, hence $x \ge 14$ (since $x+y+z \ge 41$).
We now eliminate several edge cases
to get $x,y,z \neq -1$ and a little more:
\begin{claim*}
  We have $x \ge 17$, $y \ge 5$, $z \ge 1$, and $\gcd(xyz, 6) = 1$.
\end{claim*}
\begin{proof}
  First, we check that neither $y$ nor $z$ is negative.
  \begin{itemize}
  \ii If $x > 0$ and $y=z=-1$, then we want $p=x+12$
  to divide either $x-43$ or $x+47$.
  We would have $0 \equiv x-43 \equiv -55 \pmod p$
  or $0\equiv x+47 \equiv 35 \pmod p$,
  but $p > 11$ contradiction.

  \ii If $x, y > 0$, and $z = -1$, then $p = 12-xy > 0$.
  However, this is clearly incompatible with $x \ge 14$.
  \end{itemize}
  Finally, obviously $xyz \neq 0$ (else $p=12$).
  So $p = xyz + 12 \ge 14 \cdot 1^2 +12 = 26$ or $p \ge 29$.
  Thus $\gcd(6,p) = 1$ hence $\gcd(6,xyz)=1$.

  We finally check that $y=1$ is impossible, which forces $y \ge 5$.
  If $y=1$ and hence $z=1$ then $p=x+12$ should divide either
  $x+51$ or $x-39$.
  These give $39 \equiv 0 \pmod p$ or $25 \equiv 0 \pmod p$,
  but we are supposed to have $p \ge 29$.
\end{proof}

In that situation $x+y+z-41$ and $x+y+z+49$ are both even,
so whichever one is divisible by $p$
is actually divisible by $2p$.
Now we deduce that:
\[ x+y+z+49 \ge 2p = 2xyz + 24 \implies 25 \ge 2xyz-x-y-z. \]
But $x \ge 17$ and $y \ge 5$ thus
\begin{align*}
  2xyz-x-y-z &= z(2xy-1) - x - y \\
  &\ge 2xy - 1 - x - y \\
  &> (x-1)(y-1) > 60
\end{align*}
which is a contradiction.
Having exhausted all the cases we conclude no solutions exist.

\begin{remark*}
  The condition that $x+y+z-41 > 0$ (which comes from ``properly divides'')
  cannot be dropped. Examples of solutions in which $x+y+z-41 = 0$
  include $(x,y,z) = (31,5,5)$ and $(x,y,z) = (29,11,1)$.
\end{remark*}
\pagebreak

\subsection{JMO 2017/5, proposed by Ivan Borsenco}
\textsl{Available online at \url{https://aops.com/community/p8117237}.}
\begin{mdframed}[style=mdpurplebox,frametitle={Problem statement}]
Let $O$ and $H$ be the circumcenter
and the orthocenter of an acute triangle $ABC$.
Points $M$ and $D$ lie on side $BC$
such that $BM=CM$ and $\angle BAD = \angle CAD$.
Ray $MO$ intersects the circumcircle of triangle $BHC$ in point $N$.
Prove that $\angle ADO = \angle HAN$.
\end{mdframed}
Let $P$ and $Q$ be the arc midpoints of $\widehat{BC}$,
so that $ADMQ$ is cyclic (as $\dang QAD = \dang QMD = 90\dg$) .
Since it's known that $(BHC)$ and $(ABC)$ are reflections across line $BC$,
it follows $N$ is the reflection of the arc midpoint $P$ across $M$.

\begin{claim*}
  Quadrilateral $ADNO$ is cyclic.
\end{claim*}
\begin{proof}
  Since $PN \cdot PO = \half PN \cdot 2PO = PM \cdot PQ = PD \cdot PA$.
\end{proof}

\begin{center}
\begin{asy}
pair A = dir(130);
pair B = dir(220);
pair C = dir(320);
filldraw(unitcircle, opacity(0.2)+lightcyan, lightblue);

pair P = dir(-90);
pair Q = dir(90);
pair D = extension(A, P, B, C);
pair O = origin;
pair M = extension(B, C, O, P);
pair N = 2*M-P;

draw(A--B--C--cycle, lightblue);
draw(A--P--Q, lightblue);
draw(A--N--D--O--A, lightblue);

filldraw(A--D--N--O--cycle, opacity(0.1)+yellow, red);

dot("$A$", A, dir(A));
dot("$B$", B, dir(B));
dot("$C$", C, dir(C));
dot("$P$", P, dir(P));
dot("$Q$", Q, dir(Q));
dot("$D$", D, dir(225));
dot("$O$", O, dir(315));
dot("$M$", M, dir(315));
dot("$N$", N, dir(315));

/* TSQ Source:

A = dir 130
B = dir 220
C = dir 320
unitcircle 0.1 lightcyan / lightblue

P = dir -90
Q = dir 90
D = extension A P B C R225
O = origin R315
M = extension B C O P R315
N = 2*M-P R315

A--B--C--cycle lightblue
A--P--Q lightblue
A--N--D--O--A lightblue

A--D--N--O--cycle 0.1 yellow / red

*/
\end{asy}
\end{center}
To finish, note that $\dang HAN = \dang ONA = \dang ODA$.

\begin{remark*}
  The orthocenter $H$ is superficial
  and can be deleted basically immediately.
  One can reverse-engineer the fact that $ADNO$ is cyclic
  from the truth of the problem statement.
\end{remark*}
\begin{remark*}
  One can also show $ADNO$ concyclic by just
  computing $\dang DAO = \dang PAO$
  and $\dang DNO = \dang DPN = \dang APQ$
  in terms of the angles of the triangle, or even more directly just because
  \[ \dang DNO = \dang DNP = \dang NPD = \dang OPD = \dang ONA = \dang HAN. \]
\end{remark*}
\pagebreak

\subsection{JMO 2017/6, proposed by Maria Monks}
\textsl{Available online at \url{https://aops.com/community/p8117190}.}
\begin{mdframed}[style=mdpurplebox,frametitle={Problem statement}]
Let $P_1$, $P_2$, \dots, $P_{2n}$ be $2n$ distinct points on the
unit circle $x^2+y^2=1$, other than $(1,0)$.
Each point is colored either red or blue,
with exactly $n$ red points and $n$ blue points.
Let $R_1$, $R_2$, \dots, $R_n$ be any ordering of the red points.
Let $B_1$ be the nearest blue point to $R_1$ traveling
counterclockwise around the circle starting from $R_1$.
Then let $B_2$ be the nearest of the remaining blue points to $R_2$
travelling counterclockwise around the circle from $R_2$, and so on,
until we have labeled all of the blue points $B_1$, \dots, $B_n$.
Show that the number of counterclockwise arcs of the form $R_i \to B_i$
that contain the point $(1,0)$ is independent of the way we chose the
ordering $R_1$, \dots, $R_n$ of the red points.
\end{mdframed}
We present two solutions, one based on
swapping and one based on an invariant.

\paragraph{First ``local'' solution by swapping two points.}
Let $1 \le i < n$ be any index and consider the two red points
$R_i$ and $R_{i+1}$.
There are two blue points $B_i$ and $B_{i+1}$ associated with them.

\begin{claim*}
  If we swap the locations of points $R_i$ and $R_{i+1}$ then
  the new arcs $R_i \to B_i$ and $R_{i+1} \to B_{i+1}$
  will cover the same points.
\end{claim*}
\begin{proof}
  Delete all the points $R_1$, \dots, $R_{i-1}$
  and $B_1$, \dots, $B_{i-1}$;
  instead focus on the positions of $R_i$ and $R_{i+1}$.

  The two blue points can then be located in three possible ways:
  either $0$, $1$, or $2$ of them lie on the arc $R_i \to R_{i+1}$.
  For each of the cases below, we illustrate on the left
  the locations of $B_i$ and $B_{i+1}$
  and the corresponding arcs in green;
  then on the right we show the modified picture
  where $R_i$ and $R_{i+1}$ have swapped.
  (Note that by hypothesis there are no other blue points in the green arcs).
  \begin{center}
  \begin{asy}
    unitsize(1cm);
    pair O = (0,0);
    picture init(bool flip) {
      picture pic;
      draw(pic, unitcircle);
      if (flip) {
        dot(pic, "$R_{i}$", dir(0), dir(0), red);
        dot(pic, "$R_{i+1}$", dir(180), dir(180), red);
      }
      else {
        dot(pic, "$R_{i+1}$", dir(0), dir(0), red);
        dot(pic, "$R_{i}$", dir(180), dir(180), red);
      }
      return pic;
    }

    picture L1 = init(true);
    picture L2 = init(true);
    picture L3 = init(true);
    picture R1 = init(false);
    picture R2 = init(false);
    picture R3 = init(false);

    real r = 0.8;
    real s = 0.9;

    // Case 1
    dot(L1, "$B_i$", dir(60), dir(60), blue);
    dot(L1, "$B_{i+1}$", dir(120), dir(120), blue);
    dot(R1, "$B_i$", dir(60), dir(60), blue);
    dot(R1, "$B_{i+1}$", dir(120), dir(120), blue);
    draw(L1, arc(O, r,   0,  60), deepgreen, EndArrow(TeXHead));
    draw(L1, arc(O, s, 180, 480), deepgreen, EndArrow(TeXHead));
    draw(R1, arc(O, r, 180, 420), deepgreen, EndArrow(TeXHead));
    draw(R1, arc(O, s,   0, 120), deepgreen, EndArrow(TeXHead));
    dot(L1, dir(140), blue);
    dot(L1, dir(150), blue);
    dot(R1, dir(140), blue);
    dot(R1, dir(150), blue);

    // Case 2
    dot(L2, "$B_i$", dir(90), dir(90), blue);
    dot(L2, "$B_{i+1}$", dir(270), dir(270), blue);
    dot(R2, "$B_i$", dir(270), dir(270), blue);
    dot(R2, "$B_{i+1}$", dir(90), dir(90), blue);
    draw(L2, arc(O, s,   0,  90), deepgreen, EndArrow(TeXHead));
    draw(L2, arc(O, s, 180, 270), deepgreen, EndArrow(TeXHead));
    draw(R2, arc(O, s, 180, 270), deepgreen, EndArrow(TeXHead));
    draw(R2, arc(O, s,   0,  90), deepgreen, EndArrow(TeXHead));
    dot(L2, dir(128), blue);
    dot(L2, dir(155), blue);
    dot(R2, dir(128), blue);
    dot(R2, dir(155), blue);
    dot(L2, dir(297), blue);
    dot(L2, dir(335), blue);
    dot(R2, dir(297), blue);
    dot(R2, dir(335), blue);

    // Case 3
    dot(L3, "$B_i$", dir(240), dir(240), blue);
    dot(L3, "$B_{i+1}$", dir(300), dir(300), blue);
    dot(R3, "$B_i$", dir(240), dir(240), blue);
    dot(R3, "$B_{i+1}$", dir(300), dir(300), blue);
    draw(L3, arc(O, r,   0, 240), deepgreen, EndArrow(TeXHead));
    draw(L3, arc(O, s, 180, 300), deepgreen, EndArrow(TeXHead));
    draw(R3, arc(O, r, 180, 240), deepgreen, EndArrow(TeXHead));
    draw(R3, arc(O, s,   0, 300), deepgreen, EndArrow(TeXHead));
    dot(L3, dir(328), blue);
    dot(L3, dir(342), blue);
    dot(R3, dir(328), blue);
    dot(R3, dir(342), blue);


    real t = 3.5;
    add(shift(0,0)*L1);
    add(shift(t,0)*R1);
    add(shift(0,-t)*L2);
    add(shift(t,-t)*R2);
    add(shift(0,-2*t)*L3);
    add(shift(t,-2*t)*R3);

    label("Case 1", (-2.5,0));
    label("Case 2", (-2.5,-t));
    label("Case 3", (-2.5,-2*t));
  \end{asy}
  \end{center}
  Observe that in all cases, the number of arcs covering
  any given point on the circumference is not changed.
  Consequently, this proves the claim.
\end{proof}

Finally, it is enough to recall that any permutation
of the red points can be achieved by swapping consecutive points
(put another way: $(i \; i+1)$ generates the permutation group $S_n$).
This solves the problem.

\begin{remark*}
  This proof does \emph{not} work if one tries to swap
  $R_i$ and $R_j$ if $|i-j| \neq 1$.
  For example if we swapped $R_i$ and $R_{i+2}$
  then there are some issues caused by the
  possible presence of the blue point $B_{i+1}$
  in the green arc $R_{i+2} \to B_{i+2}$.
\end{remark*}

\paragraph{Second longer solution using an invariant.}
Visually, if we draw all the segments $R_i \to B_i$
then we obtain a set of $n$ chords.
Say a chord is \emph{inverted} if satisfies the problem condition,
and \emph{stable} otherwise.
The problem contends that the number of stable/inverted chords
depends only on the layout of the points
and not on the choice of chords.

\begin{center}
\begin{asy}
size(6cm);
pair A(int i) { return dir(22.5+45*i); }

draw(unitcircle, grey);
dot("$(1,0)$", dir(0), dir(0));

dotfactor *= 2;
draw(A(7)--A(0), EndArrow, Margins);
draw(A(1)--A(2), EndArrow, Margins);
draw(A(3)--A(5), EndArrow, Margins);
draw(A(4)--A(6), EndArrow, Margins);

dot("$-1$", A(0), A(0), blue);
dot("$0$", A(1), A(1), red);
dot("$-1$", A(2), A(2), blue);
dot("$0$", A(3), A(3), red);
dot("$+1$", A(4), A(4), red);
dot("$0$", A(5), A(5), blue);
dot("$-1$", A(6), A(6), blue);
dot("$0$", A(7), A(7), red);
\end{asy}
\end{center}

In fact we'll describe the number of inverted chords explicitly.
Starting from $(1,0)$ we keep a running tally of $R-B$;
in other words we start the counter at $0$ and decrement by $1$ at each
blue point and increment by $1$ at each red point.
Let $x \le 0$ be the lowest number ever recorded. Then:
\begin{claim*}
  The number of inverted chords is $-x$
  (and hence independent of the choice of chords).
\end{claim*}

This is by induction on $n$.
I think the easiest thing is to delete chord $R_1 B_1$;
note that the arc cut out by this chord contains no blue points.
So if the chord was stable certainly no change to $x$.
On the other hand, if the chord is inverted,
then in particular the last point before $(1,0)$ was red,
and so $x < 0$.  In this situation one sees that deleting the chord
changes $x$ to $x+1$, as desired.
\pagebreak


\end{document}
