You are given an integer sequence $$$1, 2, \dots, n$$$. You have to divide it into two sets $$$A$$$ and $$$B$$$ in such a way that each element belongs to exactly one set and $$$|sum(A) - sum(B)|$$$ is minimum possible.The value $$$|x|$$$ is the absolute value of $$$x$$$ and $$$sum(S)$$$ is the sum of elements of the set $$$S$$$.

The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^9$$$).

Print one integer — the minimum possible value of $$$|sum(A) - sum(B)|$$$ if you divide the initial sequence $$$1, 2, \dots, n$$$ into two sets $$$A$$$ and $$$B$$$.

NoteSome (not all) possible answers to examples:In the first example you can divide the initial sequence into sets $$$A = \{1, 2\}$$$ and $$$B = \{3\}$$$ so the answer is $$$0$$$.In the second example you can divide the initial sequence into sets $$$A = \{1, 3, 4\}$$$ and $$$B = \{2, 5\}$$$ so the answer is $$$1$$$.In the third example you can divide the initial sequence into sets $$$A = \{1, 4, 5\}$$$ and $$$B = \{2, 3, 6\}$$$ so the answer is $$$1$$$.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Codeforces
{
    /*

string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            string tt = "1 " + Console.ReadLine();
            int[] a = tt.Split(' ').Select(q => Convert.ToInt32(q) - 1).ToArray();
            tt = Console.ReadLine();
            int[] b = tt.Split(' ').Select(q => Convert.ToInt32(q)).ToArray();
            int[] res = Enumerable.Repeat(-1, n).ToArray();
            res[0] = b[0];
            Dictionary<int, List<int>> childs = new Dictionary<int, List<int>>();
            for (int i = 0; i < n; i++)
                childs.Add(i, new List<int>());
2
     */
    class A
    {
        private static void Main(string[] args)
        {
            string input = Console.ReadLine();
            long n = int.Parse(input);

            n = n % 4;
            if (n == 0)
                Console.WriteLine(0);
            else if (n == 1)
                Console.WriteLine(1);
            else if (n == 2)
                Console.WriteLine(1);
            else if (n == 3)
                Console.WriteLine(0);
        }
    }
}

using System;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            Console.WriteLine(t%4==1||t%4==2?1:0);
        }
    }
}

using System;

namespace Test
{
    public class Program
    {
        private static void Main()
        {
            var line = Console.ReadLine();
            var n = long.Parse(line);

            var rem = n % 4;

            if (rem == 0 || rem == 3)
                Console.WriteLine(0);
            else
                Console.WriteLine(1);
        }
    }
}

using System;

namespace problems
{
    class Program
    {
        static void Main(string[] args)
        {
            long  n , temp;

            n= Convert.ToInt64(Console.ReadLine());

            temp = (n*(n+1))/ 2;

            Console.WriteLine(temp % 2);
        }
    }
}

using System;

namespace codeforces1102A
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = int.Parse(Console.ReadLine());
            long sum = (n * (n + 1)) / 2;
            if (sum % 2 != 0)
                Console.WriteLine(1);
            else
                Console.WriteLine(0);
        }
    }
}

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace _1000
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_531A();
        }

        public static void solve_531A()
        {
            long n = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine((n * (n + 1) / 2) % 2 == 0 ? 0 : 1);
        }

        /*
            The issue here is that you cannot easily calculate 2 to the power to 10000000.
            For that you need big arhithmetique techniques. And even this may not help
            because you need to quickly calculate powers of 2 and then you need to divide
            big integer by short integer values.
            But if you look into the problem you can actually observe that m
            can only give differnt reminders if it is less than n. If n is larger than m
            then you always have the reminder m. Furthermore, we can see by the problem
            statement that m can be maximum 8-digit number. So in order to calculate
            different reminders n must be less then 27). Why 27.
            Well, we know that (2^31) - 1 is the upper integer range int c#. And it is a 10
            digit number. Let't decrease 31 by 1 to see when we have an integer with 8 digits.
            Using calculator it's pretty easy.
         */
        public static void solve_hello2018A()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int m = Convert.ToInt32(Console.ReadLine());
            int answer = 0;
            if (n >= 27)
            {
                answer = m;
            }
            else
            {
                answer = m % Convert.ToInt32(Math.Pow(2, n));
            }

            Console.WriteLine(answer);
        }

        public static void solve_574B()
        {
            string[] nk = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(nk[0]);
            int k = Convert.ToInt32(nk[1]);

            int i = 1;
            int count = 1;
            while (i != n && i - count == k)
            {
                i++;
                count += count + 1;
            }

            Console.WriteLine(count);
        }

        public static void solve_574A()
        {
            string[] nk = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(nk[0]);
            int k = Convert.ToInt32(nk[1]);

            int[] cnt = new int[k];
            for (int i = 0; i < n; i++)
            {
                int p = Convert.ToInt32(Console.ReadLine());

                cnt[p - 1]++;
            }

            Array.Sort(cnt, (int a, int b) => b.CompareTo(a));
            int count = 0;
            int g = 0;
            int j = n % 2 > 0 ? n / 2 + 1 : n / 2;
            for (int i = 0; i < k; i++)
            {
                if (g >= j)
                {
                    break;
                }

                while (cnt[i] > 0 && g < j)
                {
                    int deduct = cnt[i] > 1 ? 2 : 1;
                    cnt[i] -= deduct;
                    count += deduct;
                    g += 1;
                }
                //int deduct = cnt[i] % 2 > 0 ? cnt[i] / 2 + 1 : cnt[i] / 2;
                /*if (j <= 0)
                {
                    break;
                }
                if (j == 1 && deduct > 1)
                {
                    count += 2;
                }
                else if (j == 1 && deduct == 1)
                {
                    count += 1;
                }
                else
                {
                    count += cnt[i];
                }

                j -= deduct;*/
            }

            Console.WriteLine(count);
        }

        public static void solve_352B()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string test = Console.ReadLine();
            int[] cnts = new int[123];

            for (int i = 0; i < n; i++)
            {
                cnts[test[i]]++;
            }

            int unq = 0;
            for (int i = 0; i < cnts.Length ;i++)
            {
                if (cnts[i] > 0)
                {
                    unq++;
                }
            }

            int answer = -1;

            //Redundancy in condition. if n must be <= 26 then of course unq will be <= 26. So we can remove it.
            if (unq <= 26 && n <= 26)
            {
                answer = n - unq;
            }

            Console.WriteLine(answer);
        }

        public static void solve_2A()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] test = Console.ReadLine().Split(' ');

            int max = int.MinValue;
            int maxI = 0;
            int min = int.MaxValue;
            int minI = 0;
            for (int i = 0; i < n; i++)
            {
                int num = Convert.ToInt32(test[i]);
                if (max < num)
                {
                    max = num;
                    maxI = i;
                }

                if (min > num)
                {
                    min = num;
                    minI = i;
                }
            }

            //n - 1 - because index starts at 0 and ends at n - 1
            // or we could add +1 to minI and maxI and count from 1.
            Console.WriteLine(Math.Abs(minI - maxI) + Math.Max(n - 1 - Math.Max(minI, maxI), Math.Min(minI, maxI)));
        }
        public static void solve_360B()
        {
            string n = Console.ReadLine();

            Console.WriteLine(n + String.Join("", n.Reverse().ToList()));
        }

    }
}

using System;

namespace CSharp
{
    class _1102A
    {
        public static void Main()
        {
            long n = long.Parse(Console.ReadLine());
            Console.WriteLine(((n * (n + 1)) / 2) % 2);
        }
    }
}

using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();

        // 1 2
        // 1 2 3

        // 1 2 3 4

        if (n % 4 == 0 || (n + 1) % 4 == 0)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine(1);
        }
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        long s = (long)n * (n + 1) / 2;
        Console.WriteLine(s%2);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

class Solution
{
    static int pos(int n)
    {
        int sum = 0;
        for(int i=1; i<=n; i++)
        {
            sum += i;
        }
        if (sum % 2 == 0)
            return 0;
        else return 1;
    }
    static void Main(string[] args)
    {
        int n;
        string s=Console.ReadLine();
        n = int.Parse(s);
        int res = pos(n);
        Console.WriteLine(res);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class GFG
{
    static public void Main()
    {
        try
        {
            //int test = Convert.ToInt32(Console.ReadLine());
            //for (int i = 0; i < test; i++)

            //{
            //    var input = Console.ReadLine().Split(' ');
            //    var a = int.Parse(input[0]);
            //    var b = int.Parse(input[1]);
            //    var q = int.Parse(input[2]);

            //    for (int j = 0; j < q; j++)
            //    {
            //        var aar1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            //        YetAnotherCountProb(a, b, aar1);
            //        Console.WriteLine();
            //    }

            //}
            int n = Convert.ToInt32(Console.ReadLine());
            IntSeqDiv(n);

        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }
    }

    static void IntSeqDiv(int n)
    {

       var ans=(n)*(n+1)/2;
        if (ans % 2 == 0)
            Console.Write("0");
        else
            Console.Write("1");
    }

}

using System;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int g = (n + 1) / 2;
			Console.WriteLine(g % 2);
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ForCodeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, x = 0;
            n = Convert.ToInt32(Console.ReadLine());
            if (n % 4 == 0 || n % 4 == 3)
                x = 0;
            else if (n % 4 == 2 || n % 4 == 1)
                x = 1;
            Console.WriteLine(x);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp40
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());

            long ans = (n * (n + 1)) / 2;

            Console.WriteLine(ans % 2);

        }
    }
}

using System;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            Console.WriteLine((n * (n + 1) / 2) % 2 == 0 ? 0 : 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {
      var n = input.ReadInt();
      var m = n / 2;
      var k = n % 2;
      Console.Write(Abs(m % 2 - k));
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }

    #region Service functions

    private static void AddCount<T>(Dictionary<T, int> counter, T item)
    {
      if (counter.TryGetValue(item, out var count))
        counter[item] = count + 1;
      else
        counter.Add(item, 1);
    }

    private static int GetCount<T>(Dictionary<T, int> counter, T item)
    {
      return counter.TryGetValue(item, out var count) ? count : 0;
    }

    private static int GCD(int a, int b)
    {
      while (b != 0)
      {
        a %= b;
        var t = b;
        b = a;
        a = t;
      }
      return a;
    }

    #endregion
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public string ReadToEnd()
    {
      return this.reader.ReadToEnd();
    }

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      var result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(this.ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      var c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class A1102_IntegerSequenceDividing
    {
        public static void Main()
        {
            decimal sum = 0;
            int a = int.Parse(Console.ReadLine());

            if(a%2!=0)
            {
                int b = a / 2;

                if (b % 2 == 0)
                    Console.WriteLine(1);
                else
                    Console.WriteLine(0);
            }
            else
            {
                a = a - 1;
                int b = a / 2;

                if (b % 2 == 0)
                    Console.WriteLine(1);
                else
                    Console.WriteLine(0);
            }

        }
    }
}

using System;
using System.Numerics;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Text.RegularExpressions;

namespace ProjectEuler
{
    class Program
    {

        private static void Main()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            if (n*(n+1)/2%2 == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(1);
            }

        }
    }
}

using static System.Console;
class _1102A_Integer_Sequence_Dividing
{
    static void Main()
    {
        WriteLine(((int.Parse(ReadLine()) + 1) % 4) > 1 ? "1" : "0");
    }
}

using System;

namespace ConsoleApp
{
    internal static class Program
    {
        static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            Console.WriteLine((1 + n) * n / 2 % 2 == 0 ? 0 : 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
             int n=int.Parse(Console.ReadLine());
             int a=0;
             int b=0;
             if(n%2==0)
             {
                  if((n/2)%2==0)
                  Console.WriteLine(0);
                  else
                  Console.WriteLine(1);
             }
             else
             {
                  if((n/2+1)%2==0)
                  Console.WriteLine(0);
                  else
                  Console.WriteLine(1);
             }
             //Console.WriteLine(11/2+1);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using static Template;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pi = Pair<int, int>;

class Solver
{
    Scanner sc = new Scanner();
    //

    public void Solve()
    {
        var n = sc.Long;
        n = (n + 1) * n / 2;
        WriteLine(n % 2);
    }
}

#region Template
public class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b)
    { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f();
        return rt;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<int, T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f(i);
        return rt;
    }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}

public class Scanner
{
    public string Str => ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    public Pair<T1, T2> PairMake<T1, T2>() => new Pair<T1, T2>(Next<T1>(), Next<T2>());
    public Pair<T1, T2, T3> PairMake<T1, T2, T3>() => new Pair<T1, T2, T3>(Next<T1>(), Next<T2>(), Next<T3>());
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
}

public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }
}
#endregion

using System;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            int r = n % 4;

            if (r == 1 || r == 2)
            {
                r = 1;
            }
            else
            {
                r = 0;
            }

            Console.WriteLine(r);
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Integer_Sequence_Dividing
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static long Solve(string[] args)
        {
            long n = Next();
            return (n*(n + 1)/2)%2;
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;

namespace Integer_Dividing
{
    class Program
    {
        static void Main(string[] args)
        {
            uint n = Convert.ToUInt32(Console.ReadLine());
            ulong t = n * (n + 1) / 2;
            Console.WriteLine(t % 2);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

public class Solver
{
    public void Solve()
    {
        ulong n = ulong.Parse(reader.ReadLine());
        ulong ans = (n * (n + 1) / 2) % 2;
        writer.Write(ans);
    }

    #region CSharp template by azukun

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
        Stopwatch watch = new Stopwatch();
        watch.Start();
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {

            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();

#if DEBUG
            watch.Stop();
            Write("Stopwatch: " + watch.ElapsedMilliseconds + "ms");
#endif
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array) writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
#endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace FirstDemoCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Int64.Parse(ReadLine());

            n = n * (n + 1) / 2;

            WriteLine(n % 2 == 0 ? 0 : 1);
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Text;

namespace AlgoHelper
{
    class Triplet
    {
        private int a, b, c;

        public int A { get { return a; } set { } }
        public int B { get { return b; } set { } }
        public int C { get { return c; } set { } }

        public Triplet(int a, int b, int c)
        {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public override bool Equals(object obj)
        {
            var triplet = obj as Triplet;
            return triplet != null &&
                   a == triplet.a &&
                   b == triplet.b &&
                   c == triplet.c;
        }

        public override int GetHashCode()
        {
            var hashCode = 1474027755;
            hashCode = hashCode * -1521134295 + a.GetHashCode();
            hashCode = hashCode * -1521134295 + b.GetHashCode();
            hashCode = hashCode * -1521134295 + c.GetHashCode();
            return hashCode;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());

            long s = sum(n);
            if (s % 2 == 0) Console.WriteLine(0);
            else Console.WriteLine(1);

          //  Console.ReadKey();
        }

        static long sum(long n)
        {
            return n * (n + 1) / 2;
        }
        public static IList<IList<int>> ThreeSum(int[] nums)
        {
            Array.Sort(nums);

            HashSet<Triplet> set = new HashSet<Triplet>();

            for (int i = 0; i < nums.Length - 1; i++)
            {
                int temp = nums[i];

                for (int j = i+1; j < nums.Length; j++)
                {
                    temp += nums[j];
                    int index = customBinarySearch(nums, -1*temp, j + 1);
                    if (index != -1)
                    {
                        Triplet triplet = new Triplet(nums[i], nums[j], -temp);

                        if (!set.Contains(triplet))
                        {
                            set.Add(triplet);
                        }
                    }
                    temp -= nums[j];
                }
            }

            IList<IList<int>> list = new List<IList<int>>();

            foreach (var v in set)
            {
                List<int> temp = new List<int>();
                temp.Add(v.A);
                temp.Add(v.B);
                temp.Add(v.C);
                list.Add(temp);
            }

            return list;
        }

        public static int LenLongestFibSubseq(int[] a)
        {
            int count = 2;
            int max = int.MinValue;

            int index = -1;
            int target = 0;

            for (int i = 0; i < a.Length - 1; i++)
            {
                int prev = a[i];
                int current = a[i+1];
                int currentIndex = i + 2;
                index = -1;

                for (int j = i + 1; j < a.Length;)
                {
                    if (index == -1)
                    {
                        target = a[i] + a[j];
                        index = customBinarySearch(a, target, j+1);
                        current = a[j];
                    }
                    else
                    {
                        target = prev + current;
                        index = customBinarySearch(a, target, currentIndex);
                    }

                    if (index == -1)
                    {
                        max = Math.Max(max, count);
                        j++;
                        count = 2;
                    }
                    else
                    {
                        prev = current;
                        current = a[index];
                        currentIndex = index + 1;
                        count++;
                    }
                }
            }

            max = Math.Max(max, count);

            return max == int.MinValue ? 0 : max;
        }

        private static int customBinarySearch(int[] a, int target, int index)
        {
            int lo = index;
            int hi = a.Length - 1;

            while (lo<=hi)
            {
                int med = hi - (hi - lo) / 2;
                if (a[med] == target) return med;
                else if (target < a[med]) hi = med - 1;
                else lo = med + 1;
            }
            return -1;
        }

        private static bool isFibonacciSequence(int[] a)
        {
            for (int i = 2; i < a.Length; i++)
            {
                if (a[i] != a[i - 1] + a[i - 2]) return false;
            }

            return true;
        }

        private static int LowerBound(int[] a, int i, int target)
        {
            int lo = i;
            int hi = a.Length - 1;

            if (target < a[lo]) return lo;

            int ans = -1;

            while (lo <= hi)
            {
                int med = hi - (hi - lo) / 2;

                if (a[med] == target)
                {
                    hi = med - 1;
                    ans = med;
                }
                else if (target > a[med])
                {
                    lo = med + 1;
                }
                else
                {
                    hi = med - 1;
                }
            }

            return ans;
        }

        private static int UpperBound(int[] a, int i, int target)
        {
            int lo = i;
            int hi = a.Length - 1;

            if (target > a[hi]) return hi;

            while (lo <= hi)
            {
                int med = hi - (hi - lo) / 2;

                if (a[med] == target)
                {
                    lo = med + 1;
                }
                else if (target > a[med])
                {
                    lo = med + 1;
                }
                else
                {
                    hi = med - 1;
                }
            }

            return hi;
        }

        private static int getValidMinSide(int a, int b)
        {
            int max = a > b ? a - b : b - a;

            int c = Math.Min(a + b, max);

            return c + 1;
        }

        private static int getValidMaxSide(int a, int b)
        {
            return a + b - 1;
        }

        private static int[] frequency(string s)
        {
            int[] a = new int[256];

            foreach (char c in s)
            {
                a[c]++;
            }

            return a;
        }

        public static int max(int[] a, int i)
        {
            if (i == a.Length - 1) return a[a.Length - 1];
            return Math.Max(a[i], max(a, i + 1));
        }

        private static bool isPrime(int n)
        {
            if (n < 2) return false;

            for (int i = 2; i * i <= n; i++)
            {
                if (n % i == 0) return false;
            }

            return true;
        }

        private static void Swap(ref char a, ref char b)
        {
            char temp = a;
            a = b;
            b = temp;
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		N = rl();
		N %= 4;
		long[] ans = new long[]{0, 1, 1, 0};
		Console.WriteLine(ans[N]);
	}
	long N;
	public Sol(){

	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = RInt();

            int res;
            if (n % 2 == 0)
            {
                if ((n / 2) % 2 == 0) res = 0;
                else res = 1;
            }
            else
            {
                if (((n - 1) / 2) % 2 == 0) res = 1;
                else res = 0;
            }
            Console.WriteLine(res);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            n = (n + 1) / 2;
            Console.WriteLine(n % 2);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Integer_Sequence_Dividing
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            if (n % 4 == 0 || n % 4 == 3) Console.WriteLine("0");
            else if (n % 4 == 2 || n % 4 == 1) Console.WriteLine("1");
        }
    }
}

using System;

namespace progcomp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Read
            string[] str = Console.ReadLine().Split();
            int n = int.Parse(str[0]);
            int solution = ((n+1)/2)%2;
            Console.WriteLine(solution);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.IO;
using System.Text;

using static util;
using P = pair<int, int>;

using Binary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.ParameterExpression,
                           System.Linq.Expressions.BinaryExpression>;
using Unary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.UnaryExpression>;

class Program
{
    static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static Scan sc = new Scan();
    const int M = 1000000007;
    const int M2 = 998244353;
    const long LM = (long)1e18;
    const double eps = 1e-11;
    static readonly int[] dd = { 0, 1, 0, -1, 0 };
    const string dstring = "RDLU";
    static void Main()
    {
        int n = sc.Int;
        Prt(n % 4 == 0 || n % 4 == 3 ? 0 : 1);
        sw.Flush();
    }

    static void DBG(string a) => Console.WriteLine(a);
    static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a));
    static void DBG(params object[] a) => DBG(string.Join(" ", a));
    static void Prt(string a) => sw.WriteLine(a);
    static void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a));
    static void Prt(params object[] a) => Prt(string.Join(" ", a));
}
class pair<T, U> : IComparable<pair<T, U>>
{
    public T v1;
    public U v2;
    public pair(T v1, U v2) {
        this.v1 = v1;
        this.v2 = v2;
    }
    public int CompareTo(pair<T, U> a) {
        int c = Comparer<T>.Default.Compare(v1, a.v1);
        return c != 0 ? c : Comparer<U>.Default.Compare(v2, a.v2);
    }
    public override string ToString() => v1 + " " + v2;
    public void Deconstruct(out T a, out U b) {
        a = v1; b = v2;
    }
}
static class util
{
    public static pair<T, U> make_pair<T, U>(T v1, U v2) => new pair<T, U>(v1, v2);
    public static T sq<T>(T a) => Operator<T>.Multiply(a, a);
    public static T Max<T>(params T[] a) => a.Max();
    public static T Min<T>(params T[] a) => a.Min();
    public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w;
    public static Dictionary<T, int> compress<T>(this IEnumerable<T> a)
        => a.Distinct().OrderBy(v => v).Select((v, i) => new { v, i }).ToDictionary(p => p.v, p => p.i);
    public static Dictionary<T, int> compress<T>(params IEnumerable<T>[] a) => compress(a.Aggregate(Enumerable.Union));
    public static void swap<T>(ref T a, ref T b) where T : struct { var t = a; a = b; b = t; }
    public static void swap<T>(this IList<T> a, int i, int j) where T : struct { var t = a[i]; a[i] = a[j]; a[j] = t; }
    public static T[] copy<T>(this IList<T> a) {
        var ret = new T[a.Count];
        for (int i = 0; i < a.Count; i++) ret[i] = a[i];
        return ret;
    }
}
static class Operator<T>
{
    static readonly ParameterExpression x = Expression.Parameter(typeof(T), "x");
    static readonly ParameterExpression y = Expression.Parameter(typeof(T), "y");
    public static readonly Func<T, T, T> Add = Lambda(Expression.Add);
    public static readonly Func<T, T, T> Subtract = Lambda(Expression.Subtract);
    public static readonly Func<T, T, T> Multiply = Lambda(Expression.Multiply);
    public static readonly Func<T, T, T> Divide = Lambda(Expression.Divide);
    public static readonly Func<T, T> Plus = Lambda(Expression.UnaryPlus);
    public static readonly Func<T, T> Negate = Lambda(Expression.Negate);
    public static Func<T, T, T> Lambda(Binary op) => Expression.Lambda<Func<T, T, T>>(op(x, y), x, y).Compile();
    public static Func<T, T> Lambda(Unary op) => Expression.Lambda<Func<T, T>>(op(x), x).Compile();
}

class Scan
{
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public string Str => Console.ReadLine().Trim();
    public pair<T, U> Pair<T, U>() {
        T a; U b;
        Multi(out a, out b);
        return new pair<T, U>(a, b);
    }
    public P P {
        get {
            int a, b;
            Multi(out a, out b);
            return new P(a, b);
        }
    }
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public double[] DoubleArr => StrArr.Select(double.Parse).ToArray();
    public string[] StrArr => Str.Split(new[]{' '}, StringSplitOptions.RemoveEmptyEntries);
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
                       : eq<T, long>()   ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>()   ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    public void Multi<T>(out T a) => a = cv<T>(Str);
    public void Multi<T, U>(out T a, out U b)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); }
    public void Multi<T, U, V>(out T a, out U b, out V c)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); }
    public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); }
    public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); }
    public void Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f)
    { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); f = cv<Y>(ar[5]); }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadLong();
            var ans = 0;
            if (n % 2 == 0)
            {
                n /= 2;
                if (n % 2 == 0) ans = 0;
                else ans = 1;
            }
            else
            {
                n /= 2;
                if (n % 2 == 0) ans = 1;
                else ans = 0;
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

using System;

namespace Test
{
    class Program
    {

        static void Main(string[] args)
        {
            long num1 = int.Parse(Console.ReadLine());
            var sum = (1 + num1) * num1 / 2;
            Console.WriteLine(sum - sum / 2 * 2);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace CodeForces
{
    public class Program
    {
        public static void Main(string[] args)
        {
           long n = long.Parse(Console.ReadLine());

           long SUM = n * (2 + (n-1));

           SUM = SUM/2;

           Console.WriteLine(SUM%2);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static long n,sum;
        static void Main(string[] args)
        {

            List<int> inputs = new List<int> { };

            n = Convert.ToInt32(Console.ReadLine());

            n = n * (n + 1) / 2;
            Console.WriteLine(n % 2);
            Console.Read();

        }

        public static List<int> reverse(string s)
        {
            s += " ";
            string news = "";
            List<int> res = new List<int> { };
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != ' ')
                {
                    news += s[i];
                }
                else
                {
                    res.Add(Convert.ToInt32(news));
                    news = "";
                }
            }
            return res;
        }

    }
}

using System;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            switch (n % 4)
            {
                case 0:
                case 3:
                    Console.WriteLine(0);
                    break;
                case 1:
                case 2:
                    Console.WriteLine(1);
                    break;
            }
        }
    }
}

using System;

namespace CF_1102_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            if (n * (n + 1) / 2 % 2 == 0)
                Console.WriteLine(0);
            else
                Console.WriteLine(1);
        }
    }
}

using System;

namespace _1102A
{
    class Program
    {
        static void Main(string[] args)
        {
            long nNumbers;
            nNumbers = long.Parse(Console.ReadLine());

            Console.WriteLine((((nNumbers * (nNumbers + 1) / 2) % 2 == 0) ? 0 : 1));

        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());long k = n / 2;
            if (n % 2 == 0)
            {

                if (k % 2 == 0)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    Console.WriteLine("1");
                }
            }
            else
            {
                if (k % 2 == 0)
                {
                    Console.WriteLine("1");
                }
                else
                {
                    Console.WriteLine("0");
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;

namespace A.SequenceSeparation
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());

            var result = 0;
            if(n % 2 == 0)
            {
                var x = n/2;
                result = x % 2;
            }
            else
            {
                var y = n / 2 + 1;
                result = y % 2;
            }

            Console.WriteLine(result);

            //var nBytes = GetBinaryRepresentation(n);

            //var cnt = nBytes.Count(x => x);

            //if (n == 1 || n == 2)
            //{
            //    Console.WriteLine("1");
            //}else if(n == 3)
            //{
            //    Console.WriteLine("0");
            //}else
            //{
            //    Console.WriteLine($"{(cnt % 2 == 0 ? 1 : 0)}");
            //}

            //var bl = false;
            //var ar = new bool[n];
            //for (var i = 0; i < n; i = i + 2)
            //{
            //    bl = !bl;
            //    ar[i] = bl;
            //    if (ar.Length <= i + i) break;
            //    ar[i + i] = bl;
            //}

            //Console.WriteLine($"{(ar[n - 1] ? 1 : 0)}");

            Console.Read();
        }

        private static bool[] GetBinaryRepresentation(int i)
        {
            List<bool> result = new List<bool>();
            while (i > 0)
            {
                int m = i % 2;
                i = i / 2;
                result.Add(m == 1);
            }
            //result.Reverse();
            return result.ToArray();
        }
    }
}

/*
 Project Euler, Problem 49 Solution
 C#
 */
using System;
using System.Diagnostics;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main()
        {
            //var sw = new Stopwatch();
            //sw.Start();
            //bool[] prime = new bool[10001];
            //for (int i = 2; i < 10001; i++) prime[i] = true;
            ////SEAVE OF ERAT
            //for (int i = 2; i < 10001; i++)
            //{
            //    if (prime[i] == true)
            //    {
            //        for (int j = i + i; j < 10001; j=j+i)
            //        {
            //            prime[j] = false;
            //        }
            //    }
            //}
            //List<int> pList = new List<int>();
            //for (int i = 2; i < 10001; i++)
            //{
            //    if (prime[i] == true) {
            //       // Console.WriteLine(i);
            //        pList.Add(i);
            //    }
            //}

            //Console.WriteLine("Size of List "+pList.Count);
            ///*for (int i = 1; i < pList.Count - 1; i++)
            //{
            //    if (pList[i] > 1000)
            //    {
            //        if (pList[i] - pList[i - 1] == pList[i + 1] - pList[i])
            //        {
            //            Console.WriteLine(pList[i - 1] + "" + pList[i] + "" + pList[i + 1]);
            //        }
            //    }

            //}*/
            //for (int i = 30; i < pList.Count; i++) {
            //    if (pList[i] > 1000) {
            //        int mx = 10000;
            //        for (int j = 1; j < mx; j++) {
            //            int a = pList[i] + j;
            //            int b = a + j;
            //            if (a < mx && b < mx) {
            //                if (prime[a] == true && prime[b] == true)
            //                {
            //                    if (hasSameChar(pList[i], a) == true && hasSameChar(a, b) == true)
            //                    {
            //                        Console.WriteLine(pList[i] + "" + a + "" + b);
            //                    }
            //                }
            //            }
            //        }
            //    }
            //}
            //Console.WriteLine(sw.Elapsed.TotalMilliseconds);
            //Console.ReadKey(true);
            string s = Console.ReadLine();
            long x = Convert.ToInt64(s);
            int ans=1;
            if (x % 4 == 3 || x % 4 == 0) ans = 0;
            Console.WriteLine(ans);
        //    Console.ReadKey();
        }

        static bool hasSameChar(int x, int y) {
          //  bool ret = false;
            char[] t1 = new char[4];
            char[] t2 = new char[4];
            for (int i = 0; i < 4; i++) {
                int xx = x % 10;
                x = x / 10;
                int yy = y % 10;
                y = y / 10;
                t1[i] = Convert.ToChar(xx);
                t2[i] = Convert.ToChar(yy);
            }
            Array.Sort(t1);
            Array.Sort(t2);
            for(int i = 0; i < 4; i++)
            {
                if (t1[i] != t2[i]) return false;
            }

            return true;
        }

    }
}

// PROJECT EULER SOLUTION 49

using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			//string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			//var inputs1 = input1.Split(new[] {' ', '}', '{', ','}, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs2 = input2.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs3 = input3.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs4 = input4.Split(new[] { ' ', '}', '{', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();

			long n = long.Parse(input1);

			if (n % 4 == 0 || n % 4 == 3)
			{
				Console.WriteLine(0);
			}
			else
			{
				Console.WriteLine(1);
			}
		}

		public class Team
		{
			public string Name { get; set; }

			public int Points { get; set; }

			public int GoalsFor { get; set; }

			public int GoalsAgainst { get; set; }
		}

		static long Factorial(long a)
		{
			return a > 1 ? a * Factorial(a - 1) : 1;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            if(n*(1+n)/2 % 2 == 0)
                Console.WriteLine(0);
            else
            {
                Console.WriteLine(1);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    public class IntegerSequenceDividing
    {
        public static void Main()
        {
            new IntegerSequenceDividing().Solve(Console.In, Console.Out);
        }

        public void Solve(TextReader tr, TextWriter tw)
        {
            tw.WriteLine(Solve(int.Parse(tr.ReadLine())));
        }

        public int Solve(int v)
        {
            return (v + 1) % 4 / 2;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace x
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine()), ost;

            ost = n % 4;

            //Console.WriteLine(ost);
            if (ost == 3 || ost == 0)
                Console.WriteLine(0);
            else if (ost == 1 || ost == 2)
                    Console.WriteLine(1);

                //Console.ReadKey();
        }
    }
}

using System;

namespace problems
{
    class Program
    {
        static void Main(string[] args)
        {
            int n , temp;

            n= Convert.ToInt32(Console.ReadLine());

            temp = (n*(n+1))/ 2;

            Console.WriteLine(temp % 2);
        }
    }
}

using System;

namespace CSharp
{
    class _1102A
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine(((n * (n + 1)) / 2) % 2);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class GFG
{
    static public void Main()
    {
        try
        {
            //int test = Convert.ToInt32(Console.ReadLine());
            //for (int i = 0; i < test; i++)

            //{
            //    var input = Console.ReadLine().Split(' ');
            //    var a = int.Parse(input[0]);
            //    var b = int.Parse(input[1]);
            //    var q = int.Parse(input[2]);

            //    for (int j = 0; j < q; j++)
            //    {
            //        var aar1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            //        YetAnotherCountProb(a, b, aar1);
            //        Console.WriteLine();
            //    }

            //}
            int n = Convert.ToInt32(Console.ReadLine());
            IntSeqDiv(n);

        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }
    }

    static void IntSeqDiv(int n)
    {

        int leftSum = 0;
        int rightSum = 0;

        for (int i = n; i > 1; i--)
        {
            if (i % 2 == 0)
                leftSum = leftSum + i;
            else
                rightSum = rightSum + i;

        }

        var ans1 = Math.Abs((leftSum + 1) - rightSum);
        var ans2 = Math.Abs((leftSum) - (rightSum + 1));

        Console.Write(Math.Min(ans1, ans2));
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class GFG
{
    static public void Main()
    {
        try
        {
            //int test = Convert.ToInt32(Console.ReadLine());
            //for (int i = 0; i < test; i++)

            //{
            //    var input = Console.ReadLine().Split(' ');
            //    var a = int.Parse(input[0]);
            //    var b = int.Parse(input[1]);
            //    var q = int.Parse(input[2]);

            //    for (int j = 0; j < q; j++)
            //    {
            //        var aar1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            //        YetAnotherCountProb(a, b, aar1);
            //        Console.WriteLine();
            //    }

            //}
            int n = Convert.ToInt32(Console.ReadLine());
            IntSeqDiv(n);

        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }
    }

    static void IntSeqDiv(int n)
    {

        int leftSum = 0;
        int rightSum = 0;

        for (int i = n; i > 1; i--)
        {
            if (n % 2 == 0)
                leftSum = leftSum + i;
            else
                rightSum = rightSum + i;

        }

        var ans1 = Math.Abs((leftSum + 1) - rightSum);
        var ans2 = Math.Abs((leftSum) - (rightSum + 1));

        Console.Write(Math.Min(ans1, ans2));
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp40
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());

            if (n < 3)
                Console.WriteLine(1);
            else if((n-3)%4==0)
                Console.WriteLine(0);
            else
                Console.WriteLine(1);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp40
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());

            if (n % 4 == 0)
                Console.WriteLine(0);
            else
                Console.WriteLine(1);

        }
    }
}

using System;

namespace ConsoleApp
{
    internal static class Program
    {
        static void Main()
        {
            Console.WriteLine(int.Parse(Console.ReadLine()) % 2 == 0 ? 0 : 1);
        }
    }
}

using System;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            Console.WriteLine(n % 2);
        }
    }
}

using System;

namespace Integer_Dividing
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            long t = n * (n + 1) / 2;
            Console.WriteLine(t % 2);
        }
    }
}

using System;

namespace Integer_Dividing
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int t = n * (n + 1) / 2;
            Console.WriteLine(t % 2);
        }
    }
}

using System;

namespace Test
{
    class Program
    {

        static void Main(string[] args)
        {
            var num1 = int.Parse(Console.ReadLine());
            var sum = (1 + num1) * num1 / 2;
            Console.WriteLine(sum - sum / 2 * 2);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace CodeForces
{
    public class Program
    {
        public static void Main(string[] args)
        {
           int n = int.Parse(Console.ReadLine());

           int SUM = n * (2 + (n-1));

           SUM = SUM/2;

           Console.WriteLine(SUM%2);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static long n,sum;
        static void Main(string[] args)
        {

            List<int> inputs = new List<int> { };

            n = Convert.ToInt32(Console.ReadLine());

            for(long i = 0; i < n; i++)
            {
                sum += n;
            }
            Console.WriteLine(sum%2);
            Console.Read();

        }

        public static List<int> reverse(string s)
        {
            s += " ";
            string news = "";
            List<int> res = new List<int> { };
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != ' ')
                {
                    news += s[i];
                }
                else
                {
                    res.Add(Convert.ToInt32(news));
                    news = "";
                }
            }
            return res;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static long n, k;
        static void Main(string[] args)
        {

            List<int> inputs = new List<int> { };

            n = Convert.ToInt64(Console.ReadLine());

            long[] nums = new long[n];
            long sum = 0;

            for(int i = 0; i < n; i++)
            {
                nums[i] = i + 1;

            }
            for(int i = 0; i < n; i++)
            {
                if (Math.Abs((nums.Sum() - (sum + nums[i])) - (sum + nums[i])) < Math.Abs((nums.Sum() - sum) - sum))
                {
                    sum += nums[i];
                }
                else
                {
                    Console.WriteLine(Math.Abs((nums.Sum() - sum) - sum));
                    Console.Read();
                    return;
                }

                if(nums.Sum() - sum <= sum)
                {
                    for(int u = 0; u < i; u++)
                    {
                        if(Math.Abs((nums.Sum() - (sum - nums[u])) - (sum - nums[u])) < Math.Abs((nums.Sum() - sum) - sum))
                        {
                            sum -= nums[u];
                        }
                        else
                        {
                            Console.WriteLine(Math.Abs((nums.Sum() - sum) - sum));
                            Console.Read();
                            return;
                        }
                    }
                }
            }

            Console.Read();

        }

        public static List<int> reverse(string s)
        {
            s += " ";
            string news = "";
            List<int> res = new List<int> { };
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != ' ')
                {
                    news += s[i];
                }
                else
                {
                    res.Add(Convert.ToInt32(news));
                    news = "";
                }
            }
            return res;
        }

    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());
            if (n == 3)
            {
                Console.WriteLine("0");

            }
            else
            {
                if (n % 2 == 0)
                {
                    Console.WriteLine("0");

                }
                else
                {
                    Console.WriteLine("1");
                }
            }
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());
            if (n % 2 == 0)
            {
                Console.WriteLine("0");

            }
            else
            {
                Console.WriteLine("1");
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace A.SequenceSeparation
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());
            var nBytes = GetBinaryRepresentation(n);

            var cnt = nBytes.Count(x => x);

            if (n == 1 || n == 2)
            {
                Console.WriteLine("1");
            }else if(n == 3)
            {
                Console.WriteLine("0");
            }else
            {
                Console.WriteLine($"{(cnt % 2 == 0 ? 1 : 0)}");
            }

            //var bl = false;
            //var ar = new bool[n];
            //for (var i = 0; i < n; i = i + 2)
            //{
            //    bl = !bl;
            //    ar[i] = bl;
            //    if (ar.Length <= i + i) break;
            //    ar[i + i] = bl;
            //}

            //Console.WriteLine($"{(ar[n - 1] ? 1 : 0)}");

            Console.Read();
        }

        private static bool[] GetBinaryRepresentation(int i)
        {
            List<bool> result = new List<bool>();
            while (i > 0)
            {
                int m = i % 2;
                i = i / 2;
                result.Add(m == 1);
            }
            //result.Reverse();
            return result.ToArray();
        }
    }
}

using System;

namespace A.SequenceSeparation
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());

            var bl = false;
            var ar = new bool[n];
            for (var i = 0; i < n; i = i + 2)
            {
                bl = !bl;
                ar[i] = bl;
                if (ar.Length <= i + i) break;
                ar[i + i] = bl;
            }

            Console.WriteLine($"{(ar[n - 1] ? 1 : 0)}");

            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace A.SequenceSeparation
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());
            var nBytes = GetBinaryRepresentation(n);

            var cnt = nBytes.Count(x => x);

            Console.WriteLine($"{(cnt%2 == 0 ? 1 : 0)}");

            //var bl = false;
            //var ar = new bool[n];
            //for (var i = 0; i < n; i = i + 2)
            //{
            //    bl = !bl;
            //    ar[i] = bl;
            //    if (ar.Length <= i + i) break;
            //    ar[i + i] = bl;
            //}

            //Console.WriteLine($"{(ar[n - 1] ? 1 : 0)}");

            Console.Read();
        }

        private static bool[] GetBinaryRepresentation(int i)
        {
            List<bool> result = new List<bool>();
            while (i > 0)
            {
                int m = i % 2;
                i = i / 2;
                result.Add(m == 1);
            }
            //result.Reverse();
            return result.ToArray();
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    public class IntegerSequenceDividing
    {
        public static void Main()
        {
            new IntegerSequenceDividing().Solve(Console.In, Console.Out);
        }

        public void Solve(TextReader tr, TextWriter tw)
        {
            tw.WriteLine(Solve(int.Parse(tr.ReadLine())));
        }

        public int Solve(int v)
        {
            return v % 4 / 2 ^ 1;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace x
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            if (n == 3)
                Console.WriteLine(0);
            else if (n % 4 == 0)
                    Console.WriteLine(0);
                else
                    Console.WriteLine(1);
                //Console.ReadKey();
        }
    }
}