using System;

class Program {
  static void Main() {
    var n = int.Parse(Console.ReadLine());
    var cur = 0;
    var add = 1;
    for (var i = 1; i < n ; i++) {
      Console.Write("{0} ", cur + 1);
      cur = (cur + add)%n;
      add++;
    }
  }
}

A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count. The game goes as follows. Kids stand in circle. Let's agree to think of the children as numbered with numbers from 1 to n clockwise and the child number 1 is holding the ball. First the first child throws the ball to the next one clockwise, i.e. to the child number 2. Then the child number 2 throws the ball to the next but one child, i.e. to the child number 4, then the fourth child throws the ball to the child that stands two children away from him, i.e. to the child number 7, then the ball is thrown to the child who stands 3 children away from the child number 7, then the ball is thrown to the child who stands 4 children away from the last one, and so on. It should be mentioned that when a ball is thrown it may pass the beginning of the circle. For example, if n = 5, then after the third throw the child number 2 has the ball again. Overall, n - 1 throws are made, and the game ends.The problem is that not all the children get the ball during the game. If a child doesn't get the ball, he gets very upset and cries until Natalia Pavlovna gives him a candy. That's why Natalia Pavlovna asks you to help her to identify the numbers of the children who will get the ball after each throw.

The first line contains integer n (2 ≤ n ≤ 100) which indicates the number of kids in the circle.

In the single line print n - 1 numbers which are the numbers of children who will get the ball after each throw. Separate the numbers by spaces.

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)
        {
            int n = int.Parse(Console.ReadLine());
            int current = 0;
            int q = 1;
            for (int i = 0; i < n-1; i++ )
            {
                current = (current + q) % n;
                q++;
                Console.Write((current + 1) + " ");
            }
        }
    }
}


using System;
using System.Numerics;
class Program
{
    static void Main()
    {
        const long mod = 1000000007;
        var n = long.Parse(Console.ReadLine());
        Console.WriteLine(BigInteger.Remainder(BigInteger.ModPow(2, n - 1, mod) * (1 + BigInteger.ModPow(2, n, mod)), mod));
    }
}

Dwarfs have planted a very interesting plant, which is a triangle directed "upwards". This plant has an amusing feature. After one year a triangle plant directed "upwards" divides into four triangle plants: three of them will point "upwards" and one will point "downwards". After another year, each triangle plant divides into four triangle plants: three of them will be directed in the same direction as the parent plant, and one of them will be directed in the opposite direction. Then each year the process repeats. The figure below illustrates this process.  Help the dwarfs find out how many triangle plants that point "upwards" will be in n years.

The first line contains a single integer n (0 ≤ n ≤ 1018) — the number of full years when the plant grew. Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier.

Print a single integer — the remainder of dividing the number of plants that will point "upwards" in n years by 1000000007 (109 + 7).

NoteThe first test sample corresponds to the second triangle on the figure in the statement. The second test sample corresponds to the third one.

namespace Csharp_Contest
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Globalization;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading;
/*
 * #import_IntegerMatrix.cs
 */
    static class Program
    {
        private static int mod = (int)(1e9) + 7;

        static void Solve()
        {
            long n = NextLong();
            IntegerMatrix matrix = new IntegerMatrix(2, mod);
            matrix.Reset();
            matrix[0, 0] = 3;
            matrix[0, 1] = 1;
            matrix[1, 0] = 1;
            matrix[1, 1] = 3;
            var ans = matrix ^ n;
            Console.WriteLine(ans[0, 0]);
        }

        public static void Main(string[] args)
        {
#if CLown1331
            for (int testCase = 0; testCase < 3; testCase++)
            {
                Solve();
            }

            Utils.CreateFileForSubmission();
            if (Debugger.IsAttached) Thread.Sleep(Timeout.Infinite);
#else
            if (args.Length == 0)
            {
                Console.SetOut(new Printer(Console.OpenStandardOutput()));
            }

            Thread t = new Thread(Solve, 134217728);
            t.Start();
            t.Join();
            Console.Out.Flush();
#endif
        }

        static int NextInt() => int.Parse(Console_.NextString());
        static long NextLong() => long.Parse(Console_.NextString());
        static double NextDouble() => double.Parse(Console_.NextString());
        static string NextString() => Console_.NextString();
        static string NextLine() => Console.ReadLine();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }

        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString()
            {
                if (param.Count == 0)
                {
                    foreach (string item in NextLine().Split(' '))
                    {
                        param.Enqueue(item);
                    }
                }
                return param.Dequeue();
            }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider => CultureInfo.InvariantCulture;
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
    }
}
namespace Csharp_Contest
{
/*
 * #import_Matrix.cs
 */
    public class IntegerMatrix: Matrix<int>
    {
        private readonly int mod;

        public IntegerMatrix(int size, int mod) : base(size)
        {
            this.mod = mod;
        }

        public override void Identity()
        {
            for (int i = 0; i < this.Size; i++)
            {
                for (int j = 0; j < this.Size; j++)
                {
                    this[i, j] = (i == j) ? 1 : 0;
                }
            }
        }

        protected override Matrix<int> Add(Matrix<int> right)
        {
            IntegerMatrix temp = new IntegerMatrix(this.Size, this.mod);
            temp.Reset();
            for (int i = 0; i < this.Size; i++)
            {
                for (int j = 0; j < this.Size; j++)
                {
                    temp[i, j] = (this[i, j] + right[i, j]) % this.mod;
                    while (temp[i, j] >= this.mod)
                    {
                        temp[i, j] -= this.mod;
                    }
                }
            }

            return temp;
        }

        protected override Matrix<int> Multiply(Matrix<int> right)
        {
            IntegerMatrix temp = new IntegerMatrix(this.Size, this.mod);
            temp.Reset();
            for (int i = 0; i < this.Size; i++)
            {
                for (int j = 0; j < this.Size; j++)
                {
                    for (int k = 0; k < this.Size; k++)
                    {
                        temp[i, k] += (int)((1L * this[i, j] * right[j, k]) % this.mod);
                        while (temp[i, k] >= this.mod)
                        {
                            temp[i, k] -= this.mod;
                        }
                    }
                }
            }

            return temp;
        }

        protected override Matrix<int> Power(long power)
        {
            IntegerMatrix ans = new IntegerMatrix(this.Size, this.mod);
            ans.Identity();
            IntegerMatrix num = this;
            for (; power > 0; power >>= 1)
            {
                if (power % 2 == 1)
                {
                    ans = (IntegerMatrix)(ans * num);
                }

                num = (IntegerMatrix)(num * num);
            }

            return ans;
        }
    }
}
namespace Csharp_Contest
{
    public abstract class Matrix<T>
    {
        private T[,] a;
        private readonly int size;

        protected Matrix(int size)
        {
            this.size = size;
            this.a = new T[this.size, this.size];
        }

        public void Reset()
        {
            for (int i = 0; i < this.size; i++)
            {
                for (int j = 0; j < this.size; j++)
                {
                    this[i, j] = default(T);
                }
            }
        }

        public abstract void Identity();

        public static Matrix<T> operator+ (Matrix<T> a, Matrix<T> b)
        {
            return a.Add(b);
        }

        protected abstract Matrix<T> Add(Matrix<T> right);

        public static Matrix<T> operator *(Matrix<T> a, Matrix<T> b)
        {
            return a.Multiply(b);
        }

        protected abstract Matrix<T> Multiply(Matrix<T> right);

        public static Matrix<T> operator ^(Matrix<T> a, long power)
        {
            return a.Power(power);
        }

        public static Matrix<T> operator ^(Matrix<T> a, int power)
        {
            return a.Power(power);
        }

        public T this[int i, int j]
        {
            get => this.a[i, j];
            set => this.a[i, j] = value;
        }

        protected abstract Matrix<T> Power(long power);

        public int Size => this.size;
    }
}


    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.IO;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Threading;

    namespace Codeforces
    {
        class Program : IDisposable
        {
            private static readonly TextReader textReader = new StreamReader(Console.OpenStandardInput());
            private static readonly TextWriter textWriter = new StreamWriter(Console.OpenStandardOutput());

            private void Solve()
            {
                var n = int.Parse(Console.ReadLine());
                var s = Console.ReadLine().Split(':');
                var hh = int.Parse(s[0]);
                string sHH = s[0], sMM = s[1];
                var mm = int.Parse(s[1]);
                if (n == 12)
                {
                    if (hh < 1 || hh > 12)
                    {
                        sHH = string.Format("{0}{1}",0,hh.ToString()[1]);
                    }
                }
                else
                {
                    if (hh < 1 || hh > 23)
                    {
                        sHH = string.Format("{0}{1}", 0, hh.ToString()[1]);
                    }
                }

                if (mm < 1 || mm > 59)
                {
                    sMM = string.Format("{0}{1}", 1, mm.ToString()[1]);
                }
                Console.WriteLine("{0}:{1}",sHH, sMM);
            }

            static void Main(string[] args)
            {
                var p = new Program();
                p.Solve();
                //Console.ReadLine();
                p.Dispose();
            }

            #region Helpers

            private static int ReadInt()
            {
                return int.Parse(textReader.ReadLine());
            }

            private static long ReadLong()
            {
                return long.Parse(textReader.ReadLine());
            }

            private static int[] ReadIntArray()
            {
                return textReader.ReadLine().Split(' ').Select(int.Parse).ToArray();
            }
            #endregion

            public void Dispose()
            {
                textReader.Close();
                textWriter.Close();
            }
        }
    }

You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken clock. Your goal is to change minimum number of digits in order to make clocks display the correct time in the given format.For example, if 00:99 is displayed, it is enough to replace the second 9 with 3 in order to get 00:39 that is a correct time in 24-hours format. However, to make 00:99 correct in 12-hours format, one has to change at least two digits. Additionally to the first change one can replace the second 0 with 1 and obtain 01:39.

The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.

The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.

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

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {
      int n = input.NextInt();
      int[] s = input.NextToken().Split(':').Select(int.Parse).ToArray();
      if (n == 24)
      {
        if(s[0] > 23)
          s[0] %= 10;
      }
      else
      {
        if (s[0] == 0)
          s[0] = 1;
        else if(s[0] > 12)
        {
          if (s[0] % 10 == 0)
            s[0] = 10;
          else
            s[0] %= 10;
        }
      }
      if (s[1] > 59)
      {
        s[1] %= 10;
      }
      Console.Write($"{s[0].ToString("00")}:{s[1].ToString("00")}");
    }

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

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public int NextInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      bool 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();
      int 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 NextLong()
    {
      return long.Parse(this.NextToken());
    }

    public double NextDouble()
    {
      return double.Parse(this.NextToken(), CultureInfo.InvariantCulture);
    }

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

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

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

    public string NextToken()
    {
      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()
    {
      int 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;
    }
  }

  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;

namespace ProgrammingContest.Codeforces.Round30
{
    class A
    {
        static long pow(long x, long n)
        {
            checked
            {
                long res = 1;
                for (int i = 0; i < n; i++) res *= x;
                return res;
            }
        }

        public static void Main()
        {
            checked
            {
                long[] xs = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
                long A = xs[0],
                     B = xs[1],
                     n = xs[2];
                A = Math.Abs(A);
                B = Math.Abs(B);
                for (long x = 0; x < 1000 && A * pow(x, n) <= B; x++)
                    if (A * (int)Math.Pow(x, n) == B)
                    {
                        if (xs[0] < 0 && xs[1] > 0 || xs[0] > 0 && xs[1] < 0)
                            x = -x;
                        Console.WriteLine(x);
                        return;
                    }
            }
            Console.WriteLine("No solution");
        }
    }
}

A long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.The total income A of his kingdom during 0-th year is known, as well as the total income B during n-th year (these numbers can be negative — it means that there was a loss in the correspondent year). King wants to show financial stability. To do this, he needs to find common coefficient X — the coefficient of income growth during one year. This coefficient should satisfy the equation:A·Xn = B.Surely, the king is not going to do this job by himself, and demands you to find such number X.It is necessary to point out that the fractional numbers are not used in kingdom's economy. That's why all input numbers as well as coefficient X must be integers. The number X may be zero or negative.

The input contains three integers A, B, n (|A|, |B| ≤ 1000, 1 ≤ n ≤ 10).

Output the required integer coefficient X, or «No solution», if such a coefficient does not exist or it is fractional. If there are several possible solutions, output any of them.

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace codeforces
{
    class C
    {
        //  test
        static CodeforcesUtils CF = new CodeforcesUtils(
@"
-1 1 1
");

        class Solver
        {
            public void Solve()
            {
                string[] ss = CF.ReadLine().Split(' ');
                int A = int.Parse(ss[0]);
                int B = int.Parse(ss[1]);
                int n = int.Parse(ss[2]);

                int? ans= _t(A,B,n);
                if( ans == null)
                    CF.WriteLine("No solution");
                else
                    CF.WriteLine(ans);
            }

            int? _t(int A,int B,int n)
            {
                if (A == 0)
                {
                    if (B == 0)
                        return 5;
                    return null;
                }

                if( B%A!= 0 )
                    return null;

                int C= B/A;

                if (C < 0 && n % 2 == 0)
                    return null;

                if (C == 0)
                    return 0;

                int s = Math.Sign(C);

                C=Math.Abs(C);
                n = Math.Abs(n);

                for (int x= 1; x <= 1000; x++)
                {
                    int xn = x;
                    for (int j = 1; j < n; j++)
                        xn *= x;
                    if (xn == C)
                    {
                        return s* x;
                    }
                    if (xn > C)
                        break;
                }

                return null;

            }
        }

        #region test

        static void Main(string[] args)
        {
            new Solver().Solve();
        }

        static void TLE()
        {
            for (; ; ) ;
        }

        class CodeforcesUtils
        {
            public string ReadLine()
            {
#if DEBUG
                if (_lines == null)
                {
                    _lines = new List<string>();
                    string[] ss = _test_input.Replace("\n", "").Split('\r');
                    for (int i = 0; i < ss.Length; i++)
                    {
                        if (
                            (i == 0 || i == ss.Length - 1) &&
                            ss[i].Length == 0
                            )
                            continue;

                        _lines.Add(ss[i]);
                    }
                }

                string s = null;
                if (_lines.Count > 0)
                {
                    s = _lines[0];
                    _lines.RemoveAt(0);
                }
                return s;
#else
            return Console.In.ReadLine();
#endif
            }

            public void WriteLine(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.WriteLine(o);
#else
            Console.WriteLine(o);
#endif
            }

            public void Write(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.Write(o);
#else
            Console.Write(o);
#endif
            }

            public CodeforcesUtils(string test_input)
            {
                _test_input = test_input;
            }

            string _test_input;

            List<string> _lines;
        }

        #endregion
    }
}


//#undef DEBUG

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace codeforces
{
    class C
    {
        //  test
        static CodeforcesUtils CF = new CodeforcesUtils(
@"
2 3
1 2
");

        class Solver
        {
            public void Solve()
            {
                string[] ss = CF.ReadLine().Split(' ');
                int n = int.Parse(ss[0]);
                int l = int.Parse(ss[1]);

                List<int> ai = new List<int>();
                ss = CF.ReadLine().Split(' ');
                foreach (string s in ss)
                    ai.Add(int.Parse(s));

                int c  = 0;
                foreach(int a in ai )
                {
                    c += (a/l);
                }

                CF.WriteLine(c*l);

            }

            int[,] b;

            void bs(int x, int y)
            {
                if (x < 1 || x > 8)
                    return;
                if (y < 1 || y > 8)
                    return;
                b[x, y] = 1;
            }
        }

        #region test

        static void Main(string[] args)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ru-RU");

            new Solver().Solve();
            CF.Close();
        }

        static void TLE()
        {
            for (; ; ) ;
        }

        class CodeforcesUtils
        {
            public string ReadLine()
            {
#if DEBUG
                if (_lines == null)
                {
                    _lines = new List<string>();
                    string[] ss = _test_input.Replace("\n", "").Split('\r');
                    for (int i = 0; i < ss.Length; i++)
                    {
                        if (
                            (i == 0 || i == ss.Length - 1) &&
                            ss[i].Length == 0
                            )
                            continue;

                        _lines.Add(ss[i]);
                    }
                }

                string s = null;
                if (_lines.Count > 0)
                {
                    s = _lines[0];
                    _lines.RemoveAt(0);
                }
                return s;

#else
                //return _sr.ReadLine();
            return Console.In.ReadLine();
#endif
            }

            public void WriteLine(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.WriteLine(o);
#else
                //_sw.WriteLine(o);
            Console.WriteLine(o);
#endif
            }

            public void Write(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.Write(o);
#else
                 //_sw.Write(o);
           Console.Write(o);
#endif
            }

            string _test_input;

            List<string> _lines;

#if DEBUG
            public CodeforcesUtils(string test_input)
            {
                _test_input = test_input;
            }
#else

            public CodeforcesUtils(string dummy)
            {
                //_sr = new System.IO.StreamReader("input.txt");
                //_sw = new System.IO.StreamWriter("output.txt");
            }
#endif

            public void Close()
            {
                if( _sr!= null)
                    _sr.Close();
                if( _sw != null)
                    _sw.Close();
            }

            System.IO.StreamReader _sr=null;
            System.IO.StreamWriter _sw=null;

        }

        #endregion
    }
}

The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k × d bourlemeters. Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.

The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers ai. They are the lengths of initial stripes in bourlemeters (1 ≤ ai ≤ 100).

Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.

NoteIn the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.

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

namespace Task38C
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] container = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = container[0], L = container[1];
            container = Console.ReadLine().Split().Select(int.Parse).ToArray();

            List<int> areas = new List<int>();
            int max = container.Max();
            for (int i = L; i<=max;i++)
            { int count = 0;
                foreach (int item in container)
                        count += item / i;

                areas.Add(count * i);
            }

            Console.WriteLine(areas.Count!=0? areas.Max():0);
          //  Console.ReadKey();

        }
    }
}


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

namespace olymp
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split('.');
            if (s.Length < 2)
            {
                Console.WriteLine("NO");
                return;
            }
            bool check = false;
            for (int i = 0; i < s.Length; i++)
            {
                if (i == 0 && (s[i].Length > 8 || s[i].Length == 0)) check = true;
                else if (i == s.Length - 1 && (s[i].Length > 3 || s[i].Length == 0)) check = true;
                else if (i != 0 && i != s.Length - 1 && (s[i].Length > 11 || s[i].Length == 0)) check = true;
            }
            if (check)
            {
                Console.WriteLine("NO");
            }
            else
            {
                Console.WriteLine("YES");
                string tmp = s[0] + '.';
                for (int i = 1; i < s.Length - 1; i++)
                {
                    if (s[i].Length < 4)
                    {
                        tmp += s[i].Substring(0, 1);
                        Console.WriteLine(tmp);
                        tmp = s[i].Substring(1, s[i].Length - 1) + '.';
                    }
                    else
                    {
                        tmp += s[i].Substring(0, 3);
                        Console.WriteLine(tmp);
                        tmp = s[i].Substring(3, s[i].Length - 3) + '.';
                    }
                }
                tmp += s[s.Length - 1];
                Console.WriteLine(tmp);
            }
        }
    }
}

Eudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that each file name has a form "name.ext", where:   name is a string consisting of lowercase Latin letters, its length is from 1 to 8 characters;  ext is a string consisting of lowercase Latin letters, its length is from 1 to 3 characters. For example, "read.me", "example.txt" and "b.cpp" are valid file names and "version.info", "ntldr" and "contestdata.zip" are not.Damage to the list meant that all the file names were recorded one after another, without any separators. So now Eudokimus has a single string.Eudokimus needs to set everything right as soon as possible. He should divide the resulting string into parts so that each part would be a valid file name in BerFS. Since Eudokimus has already proved that he is not good at programming, help him. The resulting file list can contain the same file names.

The input data consists of a single string s, its length is from 1 to 4·105 characters. The string can contain only lowercase Latin letters ('a' - 'z') and periods ('.').

In the first line print "YES" (without the quotes), if it is possible to divide s into parts as required. In this case, the following lines should contain the parts of the required partition, one per line in the order in which they appear in s. The required partition can contain the same file names. If there are multiple solutions, print any of them. If the solution does not exist, then print in a single line "NO" (without the quotes).

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split('.');
            Boolean Can = true;
            int c = s.Count();
            if (c == 1)
                Can = false;
            if (s[0].Length < 1 || s[0].Length > 8)
                Can = false;
            for (int i = 1; i < c - 1; i++)
            {
                if (s[i].Length < 2 || s[i].Length > 11)
                    Can = false;
            }
            if (s[c - 1].Length > 3 || s[c - 1].Length < 1)
                Can = false;
            if (!Can)
                Console.WriteLine("NO");
            else
            {
                Console.WriteLine("YES");
                Console.Write(s[0] + ".");
                for (int i = 1; i < c - 1; i++)
                {
                    int k = Math.Max(1, s[i].Length - 8);
                    for (int j = 0; j < k; j++)
                    {
                        Console.Write(s[i][j]);
                    }
                    Console.WriteLine();
                    int l = s[i].Length;
                    for (int j = k; j < s[i].Length; j++)
                    {
                        Console.Write(s[i][j]);
                    }
                    Console.Write(".");
                }
                Console.WriteLine(s[c - 1]);
            }
        }
    }
}

[{'input': 'read.meexample.txtb.cpp\r\n', 'output': ['YES\r\nread.m\r\neexample.t\r\nxtb.cpp\r\n']}, {'input': 'version.infontldrcontestdata.zip\r\n', 'output': ['NO\r\n']}, {'input': 'thisis.text.txt\r\n', 'output': ['YES\r\nthisis.t\r\next.txt\r\n']}, {'input': 'oops.t\r\n', 'output': ['YES\r\noops.t\r\n']}, {'input': 'thisislongfilename\r\n', 'output': ['NO\r\n']}, {'input': 'double..dot\r\n', 'output': ['NO\r\n']}, {'input': 'one.one.one.one.one.one.one.one.one.one\r\n', 'output': ['YES\r\none.o\r\nne.o\r\nne.o\r\nne.o\r\nne.o\r\nne.o\r\nne.o\r\nne.o\r\nne.one\r\n']}, {'input': '.\r\n', 'output': ['NO\r\n']}, {'input': 'z\r\n', 'output': ['NO\r\n']}, {'input': 'a.\r\n', 'output': ['NO\r\n']}, {'input': '.a\r\n', 'output': ['NO\r\n']}, {'input': 'za\r\n', 'output': ['NO\r\n']}, {'input': '..\r\n', 'output': ['NO\r\n']}, {'input': 'xlq\r\n', 'output': ['NO\r\n']}, {'input': '.r.\r\n', 'output': ['NO\r\n']}, {'input': 'ulmc\r\n', 'output': ['NO\r\n']}, {'input': 'nja.\r\n', 'output': ['NO\r\n']}, {'input': 't..kz\r\n', 'output': ['NO\r\n']}, {'input': 'twaha\r\n', 'output': ['NO\r\n']}, {'input': 'm..dw.\r\n', 'output': ['NO\r\n']}, {'input': 'utsvfg.\r\n', 'output': ['NO\r\n']}, {'input': '.we.voae\r\n', 'output': ['NO\r\n']}, {'input': 'kw.gkcxk.\r\n', 'output': ['NO\r\n']}, {'input': '.c.v.hpehh\r\n', 'output': ['NO\r\n']}, {'input': 'akymwh\r\n', 'output': ['NO\r\n']}, {'input': 'jx.lqv.\r\n', 'output': ['NO\r\n']}, {'input': 'qkwtq.zw\r\n', 'output': ['YES\r\nqkwtq.zw\r\n']}, {'input': 'yxwvlk..b\r\n', 'output': ['NO\r\n']}, {'input': 'ph..qlr.pt\r\n', 'output': ['NO\r\n']}, {'input': 'cab.ab.bac\r\n', 'output': ['YES\r\ncab.a\r\nb.bac\r\n']}, {'input': 'badaba.ae\r\n', 'output': ['YES\r\nbadaba.ae\r\n']}, {'input': 'badabaca.mor\r\n', 'output': ['YES\r\nbadabaca.mor\r\n']}, {'input': 'bae.a\r\n', 'output': ['YES\r\nbae.a\r\n']}, {'input': 'b.baba.ebpbac.iabaeabac.abab.adabacaba.ahcggibij.adaacab.ebaba.aa.abacaba.dacabada.daqjcpc.jadab.dab\r\n', 'output': ['YES\r\nb.b\r\naba.e\r\nbpbac.i\r\nabaeabac.a\r\nbab.a\r\ndabacaba.a\r\nhcggibij.a\r\ndaacab.e\r\nbaba.a\r\na.a\r\nbacaba.d\r\nacabada.d\r\naqjcpc.j\r\nadab.dab\r\n']}, {'input': '.ab\r\n', 'output': ['NO\r\n']}, {'input': 'aa.aa.aaaabbbbccc.ddd.ee\r\n', 'output': ['YES\r\naa.a\r\na.aaa\r\nabbbbccc.d\r\ndd.ee\r\n']}, {'input': 'a.aaaa\r\n', 'output': ['NO\r\n']}, {'input': 'aaaaread.meexample.txtb.cpp\r\n', 'output': ['YES\r\naaaaread.m\r\neexample.t\r\nxtb.cpp\r\n']}, {'input': 'abcdabcd.a\r\n', 'output': ['YES\r\nabcdabcd.a\r\n']}, {'input': 'qwertyuio.qwe\r\n', 'output': ['NO\r\n']}, {'input': 'asd.\r\n', 'output': ['NO\r\n']}, {'input': 'aaaaaaaa.\r\n', 'output': ['NO\r\n']}, {'input': 'a.txtaaaaaaaaa.txt\r\n', 'output': ['NO\r\n']}, {'input': '.abcde.cpp\r\n', 'output': ['NO\r\n']}, {'input': '.abc.cpp\r\n', 'output': ['NO\r\n']}, {'input': 'abcdefgh.aaaabcdefgh.bbb\r\n', 'output': ['YES\r\nabcdefgh.aaa\r\nabcdefgh.bbb\r\n']}, {'input': 'filename.exe\r\n', 'output': ['YES\r\nfilename.exe\r\n']}, {'input': '.abcd.cpp\r\n', 'output': ['NO\r\n']}, {'input': 'abc.bcdabcdabcd.abc\r\n', 'output': ['YES\r\nabc.bcd\r\nabcdabcd.abc\r\n']}, {'input': 'abc.abcde\r\n', 'output': ['NO\r\n']}, {'input': 'a.cp\r\n', 'output': ['YES\r\na.cp\r\n']}, {'input': 'a.b.c\r\n', 'output': ['NO\r\n']}, {'input': '.ha\r\n', 'output': ['NO\r\n']}, {'input': 'a.a.a.a\r\n', 'output': ['NO\r\n']}, {'input': 'a.a.a\r\n', 'output': ['NO\r\n']}, {'input': 'qwertyui.cp\r\n', 'output': ['YES\r\nqwertyui.cp\r\n']}, {'input': 'ss.aaaaaaaaaaaa.aa\r\n', 'output': ['NO\r\n']}, {'input': 'name.extnamename.ext\r\n', 'output': ['YES\r\nname.ext\r\nnamename.ext\r\n']}, {'input': '.aaaa.aaa\r\n', 'output': ['NO\r\n']}, {'input': 'aaaaaaaaaaaaaaaaaaaa.a\r\n', 'output': ['NO\r\n']}, {'input': '.filena.exe\r\n', 'output': ['NO\r\n']}, {'input': 'a.aaaaaaaaaaa.a\r\n', 'output': ['YES\r\na.aaa\r\naaaaaaaa.a\r\n']}, {'input': '.aa.w\r\n', 'output': ['NO\r\n']}]


using System;
using System.Linq;

namespace TaskB
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
            int N = nm[0];
            int M = nm[1];
            string[] strs = new string[N];
            for (int i = 0; i < N; i++)
                strs[i] = Console.ReadLine();
            bool[,] bl = new bool[N,M];
            for (int i = 0; i < N; i++)
                for (int j = 0; j < M; j++)
                {
                    string s = strs[i].Remove(j,1);
                    if (s.Contains(strs[i][j]))
                    {
                        bl[i, j] = true;
                        continue;
                    }

                    for (int k = 0; k < M; k++)
                        if (k != i && strs[k][j] == strs[i][j])
                        {
                            bl[i, j] = true;
                            continue;
                        }
                }

            string res = string.Empty;
            for (int i = 0; i < N; i++)
                for (int j = 0; j < M; j++)
                    if (!bl[i, j]) res += strs[i][j];
            Console.WriteLine(res);
        }
    }
}

An African crossword is a rectangular table n × m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a letter should only be crossed out if and only if the corresponding column or row contains at least one more letter that is exactly the same. Besides, all such letters are crossed out simultaneously.When all repeated letters have been crossed out, we should write the remaining letters in a string. The letters that occupy a higher position follow before the letters that occupy a lower position. If the letters are located in one row, then the letter to the left goes first. The resulting word is the answer to the problem.You are suggested to solve an African crossword and print the word encrypted there.

The first line contains two integers n and m (1 ≤ n, m ≤ 100). Next n lines contain m lowercase Latin letters each. That is the crossword grid.

Print the encrypted word on a single line. It is guaranteed that the answer consists of at least one letter.

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

namespace Codeforces
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Trim().Split(' ');
            var n = Int32.Parse(input[0]);
            var m = Int32.Parse(input[1]);

            var index = new int[n][];
            var chars = new string[n];

            for (int i = 0; i < n; i++)
            {
                chars[i] = Console.ReadLine();
                index[i] = new int[m];
            }
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    if (index[i][j] != 1)
                    {
                        for (int k = i + 1; k < n; k++)
                            if (chars[i][j] == chars[k][j])
                                index[i][j] = index[k][j] = 1;
                    }
                    if (index[i][j] != 2)
                    {
                        for (int k = j + 1; k < m; k++)
                            if (chars[i][j] == chars[i][k])
                                index[i][j] = index[i][k] = 2;
                    }
                }
            }
            var output = new List<char>();
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    if (index[i][j] == 0)
                        output.Add(chars[i][j]);
            Console.WriteLine(new string(output.ToArray()));

        }
    }
}

[{'input': '3 3\r\ncba\r\nbcd\r\ncbc\r\n', 'output': ['abcd']}, {'input': '5 5\r\nfcofd\r\nooedo\r\nafaoa\r\nrdcdf\r\neofsf\r\n', 'output': ['codeforces']}, {'input': '4 4\r\nusah\r\nusha\r\nhasu\r\nsuha\r\n', 'output': ['ahhasusu']}, {'input': '7 5\r\naabcd\r\neffgh\r\niijkk\r\nlmnoo\r\npqqrs\r\nttuvw\r\nxxyyz\r\n', 'output': ['bcdeghjlmnprsuvwz']}, {'input': '10 10\r\naaaaaaaaaa\r\nbccceeeeee\r\ncdfffffffe\r\ncdfiiiiile\r\ncdfjjjjile\r\ndddddddile\r\nedfkkkkile\r\nedddddddde\r\ngggggggggg\r\nhhhhhhhhhe\r\n', 'output': ['b']}, {'input': '15 3\r\njhg\r\njkn\r\njui\r\nfth\r\noij\r\nyuf\r\nyfb\r\nugd\r\nhgd\r\noih\r\nhvc\r\nugg\r\nyvv\r\ntdg\r\nhgf\r\n', 'output': ['hkniftjfbctd']}, {'input': '17 19\r\nbmzbmweyydiadtlcoue\r\ngmdbyfwurpwbpuvhifn\r\nuapwyndmhtqvkgkbhty\r\ntszotwflegsjzzszfwt\r\nzfpnscguemwrczqxyci\r\nvdqnkypnxnnpmuduhzn\r\noaquudhavrncwfwujpc\r\nmiggjmcmkkbnjfeodxk\r\ngjgwxtrxingiqquhuwq\r\nhdswxxrxuzzfhkplwun\r\nfagppcoildagktgdarv\r\neusjuqfistulgbglwmf\r\ngzrnyxryetwzhlnfewc\r\nzmnoozlqatugmdjwgzc\r\nfabbkoxyjxkatjmpprs\r\nwkdkobdagwdwxsufees\r\nrvncbszcepigpbzuzoo\r\n', 'output': ['lcorviunqvgblgjfsgmrqxyivyxodhvrjpicbneodxjtfkpolvejqmllqadjwotmbgxrvs']}, {'input': '1 1\r\na\r\n', 'output': ['a']}, {'input': '2 2\r\nzx\r\nxz\r\n', 'output': ['zxxz']}, {'input': '1 2\r\nfg\r\n', 'output': ['fg']}, {'input': '2 1\r\nh\r\nj\r\n', 'output': ['hj']}, {'input': '1 3\r\niji\r\n', 'output': ['j']}, {'input': '3 1\r\nk\r\np\r\nk\r\n', 'output': ['p']}, {'input': '2 3\r\nmhw\r\nbfq\r\n', 'output': ['mhwbfq']}, {'input': '3 2\r\nxe\r\ner\r\nwb\r\n', 'output': ['xeerwb']}, {'input': '3 7\r\nnutuvjg\r\ntgqutfn\r\nyfjeiot\r\n', 'output': ['ntvjggqfnyfjeiot']}, {'input': '5 4\r\nuzvs\r\namfz\r\nwypl\r\nxizp\r\nfhmf\r\n', 'output': ['uzvsamfzwyplxizphm']}, {'input': '8 9\r\ntjqrtgrem\r\nrwjcfuoey\r\nywrjgpzca\r\nwabzggojv\r\najqmmcclh\r\nozilebskd\r\nqmgnbmtcq\r\nwakptzkjr\r\n', 'output': ['mrjcfuyyrjpzabzvalhozilebskdgnbtpzr']}, {'input': '9 3\r\njel\r\njws\r\ntab\r\nvyo\r\nkgm\r\npls\r\nabq\r\nbjx\r\nljt\r\n', 'output': ['elwtabvyokgmplabqbxlt']}, {'input': '7 6\r\neklgxi\r\nxmpzgf\r\nxvwcmr\r\nrqssed\r\nouiqpt\r\ndueiok\r\nbbuorv\r\n', 'output': ['eklgximpzgfvwcmrrqedoiqptdeiokuorv']}, {'input': '14 27\r\npzoshpvvjdpmwfoeojapmkxjrnk\r\nitoojpcorxjdxrwyewtmmlhjxhx\r\ndoyopbwusgsmephixzcilxpskxh\r\nygpvepeuxjbnezdrnjfwdhjwjka\r\nrfjlbypoalbtjwrpjxzenmeipfg\r\nkhjhrtktcnajrnbefhpavxxfnlx\r\nvwlwumqpfegjgvoezevqsolaqhh\r\npdrvrtzqsoujqfeitkqgtxwckrl\r\nxtepjflcxcrfomhqimhimnzfxzg\r\nwhkfkfvvjwkmwhfgeovwowshyhw\r\nolchgmhiehumivswgtfyhqfagbp\r\ntdudrkttpkryvaiepsijuejqvmq\r\nmuratfqqdbfpefmhjzercortroh\r\nwxkebkzchupxumfizftgqvuwgau\r\n', 'output': ['zshdanicdyldybwgclygzrhkayatwxznmicbpvlupfsoewcleploqngsyolceswtyqbpyasmuadbpcehqva']}, {'input': '1 100\r\nysijllpanprcrrtvokqmmupuptvawhvnekeybdkzqaduotmkfwybqvytkbjfzyqztmxckizheorvkhtyoohbswcmhknyzlgxordu\r\n', 'output': ['g']}, {'input': '2 100\r\ngplwoaggwuxzutpwnmxhotbexntzmitmcvnvmuxknwvcrnsagvdojdgaccfbheqojgcqievijxapvepwqolmnjqsbejtnkaifstp\r\noictcmphxbrylaarcwpruiastazvmfhlcgticvwhpxyiiqokxcjgwlnfykkqdsfmrfaedzchrfzlwdclqjxvidhomhxqnlmuoowg\r\n', 'output': ['rbe']}, {'input': '3 100\r\nonmhsoxoexfwavmamoecptondioxdjsoxfuqxkjviqnjukwqjwfadnohueaxrkreycicgxpmogijgejxsprwiweyvwembluwwqhj\r\nuofldyjyuhzgmkeurawgsrburovdppzjiyddpzxslhyesvmuwlgdjvzjqqcpubfgxliulyvxxloqyhxspoxvhllbrajlommpghlv\r\nvdohhghjlvihrzmwskxfatoodupmnouwyyfarhihxpdnbwrvrysrpxxptdidpqabwbfnxhiziiiqtozqjtnitgepxjxosspsjldo\r\n', 'output': ['blkck']}, {'input': '100 1\r\na\r\nm\r\nn\r\nh\r\na\r\nx\r\nt\r\na\r\no\r\np\r\nj\r\nz\r\nr\r\nk\r\nq\r\nl\r\nb\r\nr\r\no\r\ni\r\ny\r\ni\r\np\r\ni\r\nt\r\nn\r\nd\r\nc\r\nz\r\np\r\nu\r\nn\r\nw\r\ny\r\ng\r\ns\r\nt\r\nm\r\nz\r\ne\r\nv\r\ng\r\ny\r\nj\r\nd\r\nz\r\ny\r\na\r\nn\r\nx\r\nk\r\nd\r\nq\r\nn\r\nv\r\ng\r\nk\r\ni\r\nk\r\nf\r\na\r\nb\r\nw\r\no\r\nu\r\nw\r\nk\r\nk\r\nb\r\nz\r\nu\r\ni\r\nu\r\nv\r\ng\r\nv\r\nx\r\ng\r\np\r\ni\r\nz\r\ns\r\nv\r\nq\r\ns\r\nb\r\nw\r\ne\r\np\r\nk\r\nt\r\np\r\nd\r\nr\r\ng\r\nd\r\nk\r\nm\r\nf\r\nd\r\n', 'output': ['hlc']}, {'input': '100 2\r\nhd\r\ngx\r\nmz\r\nbq\r\nof\r\nst\r\nzc\r\ndg\r\nth\r\nba\r\new\r\nbw\r\noc\r\now\r\nvh\r\nqp\r\nin\r\neh\r\npj\r\nat\r\nnn\r\nbr\r\nij\r\nco\r\nlv\r\nsa\r\ntb\r\nbl\r\nsr\r\nxa\r\nbz\r\nrp\r\nsz\r\noi\r\nec\r\npw\r\nhf\r\njm\r\nwu\r\nhq\r\nra\r\npv\r\ntc\r\ngv\r\nik\r\nux\r\ntz\r\nbf\r\nty\r\ndk\r\nwo\r\nor\r\nza\r\nkv\r\nqt\r\nfa\r\njy\r\nbk\r\nuv\r\ngk\r\ncz\r\nds\r\nie\r\noq\r\nmf\r\nxn\r\nql\r\nxs\r\nfb\r\niv\r\ncj\r\nkn\r\nns\r\nlg\r\nji\r\nha\r\naj\r\ndg\r\nfj\r\nut\r\nsg\r\nju\r\noc\r\nov\r\nhe\r\nnw\r\nbl\r\nlp\r\nbx\r\nnm\r\nyq\r\ncw\r\nov\r\nxk\r\npg\r\noh\r\npl\r\nuo\r\ngf\r\nul\r\n', 'output': ['dvy']}, {'input': '100 3\r\nruy\r\nmye\r\njgp\r\nscn\r\nktq\r\nalx\r\nmvk\r\nlpm\r\nkry\r\norb\r\nmpu\r\nzcv\r\nlge\r\nkft\r\ndzp\r\ntfb\r\nhqz\r\nuur\r\nhry\r\nzjx\r\ncuo\r\nqqc\r\ntih\r\nenj\r\nvnp\r\nbwi\r\nzzh\r\nhkc\r\nwdr\r\nldh\r\nvel\r\nizj\r\nfhb\r\nqrn\r\nqpp\r\nvzs\r\nlhg\r\nkee\r\nlbq\r\nzhy\r\nwcl\r\nyaa\r\nton\r\nfly\r\nkyw\r\nept\r\ngwq\r\ncoe\r\nopd\r\neez\r\nnmx\r\nnjg\r\nwhy\r\nvel\r\nafq\r\nnbq\r\nulx\r\noxs\r\nbbo\r\nyhx\r\nfmz\r\nnrg\r\nnfm\r\njek\r\nbeu\r\ntya\r\nxgs\r\nsgg\r\nnkq\r\nbbv\r\nwkd\r\ntns\r\nfdt\r\neox\r\nobc\r\neab\r\nkkj\r\noub\r\ngji\r\nrht\r\nozv\r\nysk\r\nsbt\r\nflf\r\npbu\r\nlxb\r\npzs\r\nrzh\r\ncea\r\nkmi\r\nuea\r\nncc\r\nzng\r\nvkn\r\njhn\r\njqw\r\nlqc\r\nmbt\r\nlov\r\ngam\r\n', 'output': ['tvdiixs']}]


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

namespace _108c
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                //s = "4 5 ABABA BCGDG AAAAA YABSA".Split(cs, StringSplitOptions.RemoveEmptyEntries);
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return s[i++];
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }
        }
        static void Main(string[] args)
        {
            Scanner sc = new Scanner();
            int n = sc.nextInt();
            int m = sc.nextInt();

            List<char>[] lst = new List<char>[m];
            for (int i = 0; i < m; i++)
            {
                lst[i] = new List<char>();
            }

            for (int i = 0; i < n; i++)
            {
                string s = sc.next();
                for (int j = 0; j < m; j++)
                {
                    if(!lst[j].Contains(s[j]))
                    {
                        lst[j].Add(s[j]);
                    }
                }
            }

            double result = 1;

            for (int i = 0; i < m; i++)
            {
                result *= (long)lst[i].Count;
            }
            result = result % 1000000007;

            Console.WriteLine((long)result);
        }
    }
}

One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i < j ≤ n, 1 ≤ k ≤ m), then he took names number i and j and swapped their prefixes of length k. For example, if we take names "CBDAD" and "AABRD" and swap their prefixes with the length of 3, the result will be names "AABAD" and "CBDRD".You wonder how many different names Vasya can write instead of name number 1, if Vasya is allowed to perform any number of the described actions. As Vasya performs each action, he chooses numbers i, j, k independently from the previous moves and his choice is based entirely on his will. The sought number can be very large, so you should only find it modulo 1000000007 (109 + 7).

The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.

Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).

NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".

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

namespace _108c
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                //s = "4 5 AAAAA BBBBB AAAAA CCCCC".Split(cs, StringSplitOptions.RemoveEmptyEntries);
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return s[i++];
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }
        }
        static void Main(string[] args)
        {
            Scanner sc = new Scanner();
            int n = sc.nextInt();
            int m = sc.nextInt();

            List<char>[] lst = new List<char>[m];
            for (int i = 0; i < m; i++)
            {
                lst[i] = new List<char>();
            }

            for (int i = 0; i < n; i++)
            {
                string s = sc.next();
                for (int j = 0; j < m; j++)
                {
                    if(!lst[j].Contains(s[j]))
                    {
                        lst[j].Add(s[j]);
                    }
                }
            }

            long result = 1;
            long cot = 0;

            for (int i = 0; i < m; i++)
            {
                result *= (long)lst[i].Count;
                cot *= (long)lst[i].Count;
                if (result / 1000000007 > 0)
                {
                    cot += result / 1000000007;
                    result = result % 1000000007;
                }
            }
            result = result % 1000000007;

            Console.WriteLine((long)result);
        }
    }
}

[{'input': '2 3\r\nAAB\r\nBAA\r\n', 'output': ['4\r\n']}, {'input': '4 5\r\nABABA\r\nBCGDG\r\nAAAAA\r\nYABSA\r\n', 'output': ['216\r\n']}, {'input': '1 1\r\nE\r\n', 'output': ['1\r\n']}, {'input': '2 2\r\nNS\r\nPD\r\n', 'output': ['4\r\n']}, {'input': '3 4\r\nPJKD\r\nNFJX\r\nFGFK\r\n', 'output': ['81\r\n']}, {'input': '4 5\r\nSXFMY\r\nATHLM\r\nKDDQW\r\nZWGDS\r\n', 'output': ['1024\r\n']}, {'input': '20 14\r\nJNFKBBBJYZHWQE\r\nLBOKZCPFNKDBJY\r\nXKNWGHQHIOXUPF\r\nDDNRUKVUGHWMXW\r\nMTIZFNAAFEAPHX\r\nIXBQOOHEULZYHU\r\nMRCSREUEOOMUUN\r\nHJTSQWKUFYZDQU\r\nGMCMUZCOPRVEIQ\r\nXBKKGGJECOBLTH\r\nXXHTLXCNJZJUAF\r\nVLJRKXXXWMTPKZ\r\nPTYMNPTBBCWKAD\r\nQYJGOBUBHMEDYE\r\nGTKUUVVNKAHTUI\r\nZNKXYZPCYLBZFP\r\nQCBLJTRMBDWNNE\r\nTDOKJOBKEOVNLZ\r\nFKZUITYAFJOQIM\r\nUWQNSGLXEEIRWF\r\n', 'output': ['515139391\r\n']}, {'input': '5 14\r\nAQRXUQQNSKZPGC\r\nDTTKSPFGGVCLPT\r\nVLZQWWESCHDTAZ\r\nCOKOWDWDRUOMHP\r\nXDTRBIZTTCIDGS\r\n', 'output': ['124999979\r\n']}, {'input': '9 23\r\nOILBYKHRGMPENVFNHLSIUOW\r\nLPJFHTUQUINAALRDGLSQUXR\r\nLYYJJEBNZATAFQWTDZSPUNZ\r\nHSJPIQKKWWERJZIEMLCZUKI\r\nOJYIEYDGPFWRHCMISJCCUEM\r\nLMGKZVFYIVDRTIHBWPCNUTG\r\nUBGGNCITVHAIPKXCLTSAULQ\r\nOWSAWUOXQDBSXXBHTLSXUVD\r\nUGQTIZQPBGMASRQPVPSFUWK\r\n', 'output': ['454717784\r\n']}, {'input': '25 4\r\nLVKG\r\nMICU\r\nZHKW\r\nLFGG\r\nOWQO\r\nLCQG\r\nLVXU\r\nOUKB\r\nLNQX\r\nZJTO\r\nOOQX\r\nLVQP\r\nMFQB\r\nMRQV\r\nOIQH\r\nOPXX\r\nXFKU\r\nFCQB\r\nZPKH\r\nLVCH\r\nNFCU\r\nOVQW\r\nOZKU\r\nLFHX\r\nLPXO\r\n', 'output': ['5733\r\n']}, {'input': '30 10\r\nUTNTGO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nR\r\nS\r\nT\r\nU\r\nV\r\nW\r\nX\r\nY\r\nZ\r\nA\r\nB\r\nC\r\nD\r\nE\r\nF\r\nG\r\nH\r\nI\r\nJ\r\nK\r\nL\r\nM\r\nN\r\nO\r\nP\r\nQ\r\nR\r\nS\r\nT\r\nU\r\nV\r\nW\r\nX\r\nY\r\nZ\r\nA\r\nB\r\nC\r\nD\r\nE\r\nF\r\nG\r\nH\r\nI\r\nJ\r\nK\r\nL\r\nM\r\nN\r\nO\r\nP\r\nQ\r\nR\r\nS\r\nT\r\nU\r\nV\r\n', 'output': ['26\r\n']}]


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

namespace Codeforces
{
    class Program
    {
        static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static void ReadIntArray(out int[] array, char separator = ' ')
        {
            var input = Console.ReadLine().Split(separator);
            array = new int[input.Length];
            for (int i = 0; i < input.Length; i++)
            {
                array[i] = Int32.Parse(input[i]);
            }

        }

        static int ReadNextInt(string input, int index)
        {
            var ints = input.Split(' ');
            return Int32.Parse(ints[index]);
        }

        static void Main()
        {
            var input = Console.ReadLine();
            var n = ReadNextInt(input, 0);
            var m = ReadNextInt(input, 1);

            var players = new Dictionary<int, string>();
            var enemies = new Dictionary<string, List<string>>();
            for (int i = 0; i < n; i++)
            {
                players.Add(i, Console.ReadLine());
            }
            for (int i = 0; i < m; i++)
            {
                var pair = Console.ReadLine().Split(' ');
                if (!enemies.ContainsKey(pair[0]))
                    enemies[pair[0]] = new List<string>();
                enemies[pair[0]].Add(pair[1]);
                if (!enemies.ContainsKey(pair[1]))
                    enemies[pair[1]] = new List<string>();
                enemies[pair[1]].Add(pair[0]);
            }
            int res = 0;
            var resPlaers = new List<string>();
            var maxPlayers = new List<string>();
            int c = 1 << n;
            int count = 0;
            bool isGood = true;
            while (--c > 0)
            {
                count = 0;
                isGood = true;
                resPlaers.Clear();
                for (int i = 0; i < n; i++)
                {
                    if ((c & (1 << i)) == 0)
                        continue;

                    count++;
                    resPlaers.Add(players[i]);

                    for (int j = i + 1; j < n; j++)
                    {
                        if ((c & (1 << j)) == 0)
                            continue;

                        if (enemies.ContainsKey(players[i]) && enemies[players[i]].Contains(players[j]))
                        {
                            isGood = false;
                            break;
                        }
                    }

                    if (!isGood)
                        break;
                }
                if (isGood)
                {
                    if (res < count)
                    {
                        res = count;
                        maxPlayers.Clear();
                        maxPlayers.AddRange(resPlaers);
                    }
                }
            }
            Console.WriteLine(res);
            maxPlayers.Sort(StringComparer.Create(CultureInfo.InvariantCulture, true));
            foreach (var player in maxPlayers)
                Console.WriteLine(player);
        }
    }
}

When little Petya grew up and entered the university, he started to take part in АСМ contests. Later he realized that he doesn't like how the АСМ contests are organised: the team could only have three members (and he couldn't take all his friends to the competitions and distribute the tasks between the team members efficiently), so he decided to organize his own contests PFAST Inc. — Petr and Friends Are Solving Tasks Corporation. PFAST Inc. rules allow a team to have unlimited number of members.To make this format of contests popular he organised his own tournament. To create the team he will prepare for the contest organised by the PFAST Inc. rules, he chose several volunteers (up to 16 people) and decided to compile a team from them. Petya understands perfectly that if a team has two people that don't get on well, then the team will perform poorly. Put together a team with as many players as possible given that all players should get on well with each other.

The first line contains two integer numbers n (1 ≤ n ≤ 16) — the number of volunteers, and m () — the number of pairs that do not get on. Next n lines contain the volunteers' names (each name is a non-empty string consisting of no more than 10 uppercase and/or lowercase Latin letters). Next m lines contain two names — the names of the volunteers who do not get on. The names in pair are separated with a single space. Each pair of volunteers who do not get on occurs exactly once. The strings are case-sensitive. All n names are distinct.

The first output line should contain the single number k — the number of people in the sought team. Next k lines should contain the names of the sought team's participants in the lexicographical order. If there are several variants to solve the problem, print any of them. Petya might not be a member of the sought team.

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

namespace Task
{
    #region MyIo

    class MyIo : IDisposable
    {
        TextReader inputStream;
        TextWriter outputStream = Console.Out;

        string[] tokens;
        int pointer;

        public MyIo(TextReader inputStream)
        {
            this.inputStream = inputStream;
        }

        public string NextLine()
        {
            try
            {
                return inputStream.ReadLine();
            }
            catch (IOException)
            {
                return null;
            }
        }

        public string NextString()
        {
            try
            {
                while (tokens == null || pointer >= tokens.Length)
                {
                    tokens = NextLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    pointer = 0;
                }
                return tokens[pointer++];
            }
            catch (IOException)
            {
                return null;
            }
        }

        public int NextInt()
        {
            return int.Parse(NextString());
        }

        public long NextLong()
        {
            return long.Parse(NextString());
        }

        public void Print(string format, params object[] args)
        {
            outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));
        }

        public void PrintLine(string format, params object[] args)
        {
            Print(format, args);

            outputStream.WriteLine();
        }

        public void Print<T>(T o)
        {
            outputStream.Write(o);
        }

        public void PrintLine<T>(T o)
        {
            outputStream.WriteLine(o);
        }

        public void Close()
        {
            inputStream.Close();
            outputStream.Close();
        }

        void IDisposable.Dispose()
        {
            Close();
        }
    }
    #endregion

    class Program
    {
        #region Program
        MyIo io;

        public Program(MyIo io)
        {
            this.io = io;
        }

        static void Main(string[] args)
        {
#if  LOCAL_TEST
            using (MyIo io = new MyIo(new StreamReader("input.txt")))
#else
                using (MyIo io = new MyIo(System.Console.In))
#endif

            {
                new Program(io)
                    .Solve();

#if  LOCAL_TEST
                Console.ReadLine();
#endif
            }
        }

        #endregion

        public class LexComparer : IComparer<string>
        {
            private static readonly LexComparer lc = new LexComparer();

            public static LexComparer Instance
            {
                get
                {
                    return lc;
                }
            }

            public int Compare(string x, string y)
            {
                for (int i = 0; i < Math.Min(x.Length, y.Length); i++)
                {
                    if (x[i] == y[i])
                        continue;

                    return Comparer.Default.Compare(x[i], y[i]);
                }

                return Comparer.Default.Compare(x.Length, y.Length);
            }
        }

        void Solve()
        {
            int n = io.NextInt();
            int m = io.NextInt();

            List<string> names = new List<string>();

            for (int i = 0; i < n; i++)
                names.Add(io.NextString());

            names.Sort(LexComparer.Instance);

            int[] sts = new int[n];

            for (int i = 0; i < n; i++)
                sts[i] = (1 << (n + 1)) - 1;

            for (int i = 0; i < m; i++)
            {
                int x = names.BinarySearch(io.NextString(), LexComparer.Instance);
                int y = names.BinarySearch(io.NextString(), LexComparer.Instance);

                sts[x] &= ~(1 << y);
                sts[y] &= ~(1 << x);
            }

            int di = 0;
            int dz = 0;

            for (int i = 1 << n; i > 0; i--)
            {
                int xi = i;

                int z = 0;

                bool candidate = true;

                for (int j = 0; j < n; j++)
                {
                    if (xi % 2 > 0)
                    {
                        z++;

                        if ((i & sts[j]) != i)
                        {
                            candidate = false;
                            break;
                        }
                    }
                    xi >>= 1;
                }

                if (candidate && z >= dz)
                {
                    dz  = z;
                    di = i;
                }
            }

            if (dz > 0)
            {
                io.PrintLine(dz);

                for (int i = 0; i < n; i++)
			    {
                    if (((1 << i) & di) > 0)
                        io.PrintLine(names[i]);
                }
            }
        }

    }
}

[{'input': '3 1\r\nPetya\r\nVasya\r\nMasha\r\nPetya Vasya\r\n', 'output': ['2\r\nMasha\r\nPetya\r\n']}, {'input': '3 0\r\nPasha\r\nLesha\r\nVanya\r\n', 'output': ['3\r\nLesha\r\nPasha\r\nVanya\r\n']}, {'input': '7 12\r\nPasha\r\nLesha\r\nVanya\r\nTaras\r\nNikita\r\nSergey\r\nAndrey\r\nPasha Taras\r\nPasha Nikita\r\nPasha Andrey\r\nPasha Sergey\r\nLesha Taras\r\nLesha Nikita\r\nLesha Andrey\r\nLesha Sergey\r\nVanya Taras\r\nVanya Nikita\r\nVanya Andrey\r\nVanya Sergey\r\n', 'output': ['4\r\nAndrey\r\nNikita\r\nSergey\r\nTaras\r\n']}, {'input': '2 0\r\nAndrey\r\nTaras\r\n', 'output': ['2\r\nAndrey\r\nTaras\r\n']}, {'input': '16 0\r\nTaras\r\nNikita\r\nSergey\r\nAndrey\r\nRomka\r\nAlexey\r\nUra\r\nDenis\r\nEgor\r\nVadim\r\nAlena\r\nOlya\r\nVanya\r\nBrus\r\nJohn\r\nAlice\r\n', 'output': ['16\r\nAlena\r\nAlexey\r\nAlice\r\nAndrey\r\nBrus\r\nDenis\r\nEgor\r\nJohn\r\nNikita\r\nOlya\r\nRomka\r\nSergey\r\nTaras\r\nUra\r\nVadim\r\nVanya\r\n']}, {'input': '6 6\r\nAlena\r\nOlya\r\nVanya\r\nBrus\r\nJohn\r\nAlice\r\nAlena John\r\nAlena Alice\r\nOlya John\r\nOlya Alice\r\nVanya John\r\nVanya Alice\r\n', 'output': ['4\r\nAlena\r\nBrus\r\nOlya\r\nVanya\r\n']}, {'input': '7 6\r\nAlena\r\nOlya\r\nVanya\r\nBrus\r\nJohn\r\nAlice\r\nMariana\r\nAlena John\r\nAlena Alice\r\nOlya John\r\nOlya Alice\r\nVanya John\r\nVanya Alice\r\n', 'output': ['5\r\nAlena\r\nBrus\r\nMariana\r\nOlya\r\nVanya\r\n']}, {'input': '1 0\r\nPetr\r\n', 'output': ['1\r\nPetr\r\n']}, {'input': '2 0\r\nNgzlPJgFgz\r\nQfpagVpWz\r\n', 'output': ['2\r\nNgzlPJgFgz\r\nQfpagVpWz\r\n']}, {'input': '2 1\r\ncLWdg\r\nGoWegdDRp\r\nGoWegdDRp cLWdg\r\n', 'output': ['1\r\nGoWegdDRp\r\n']}, {'input': '3 0\r\nr\r\nyVwqs\r\nsdTDerOyhp\r\n', 'output': ['3\r\nr\r\nsdTDerOyhp\r\nyVwqs\r\n']}, {'input': '3 3\r\nvRVatwL\r\nWmkUGiYEn\r\nuvvsXKXcJ\r\nWmkUGiYEn vRVatwL\r\nuvvsXKXcJ vRVatwL\r\nuvvsXKXcJ WmkUGiYEn\r\n', 'output': ['1\r\nWmkUGiYEn\r\n']}, {'input': '16 11\r\njA\r\nkyRNTE\r\neY\r\nToLcqN\r\nbnenhMxiK\r\nzlkOe\r\nXCKZ\r\neaQrds\r\nqUdInpi\r\nKgPQA\r\nmQIl\r\ninOCWEZHxy\r\nyA\r\n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j\r\nUoTy RZRQl\r\nBEMAaYkNb tZDgmdF\r\n', 'output': ['6\r\nIdG\r\nIjeDjoj\r\nLAbVLYiY\r\nRZRQl\r\nlNHWt\r\notOBsWqJuo\r\n']}, {'input': '11 13\r\ncZAMfd\r\nSWQnweM\r\nKlQW\r\nWRsnNZT\r\nix\r\nUC\r\nLWqsVHcWec\r\nfeb\r\ncBy\r\ntvk\r\nRXDlX\r\nfeb SWQnweM\r\ncBy WRsnNZT\r\nLWqsVHcWec KlQW\r\nRXDlX feb\r\nLWqsVHcWec cZAMfd\r\ncBy UC\r\nWRsnNZT SWQnweM\r\nRXDlX cBy\r\ntvk UC\r\ncBy SWQnweM\r\nUC KlQW\r\nRXDlX KlQW\r\nUC WRsnNZT\r\n', 'output': ['6\r\nKlQW\r\nWRsnNZT\r\ncZAMfd\r\nfeb\r\nix\r\ntvk\r\n']}, {'input': '4 2\r\nadQx\r\nrJGeodBycK\r\ntgPYZk\r\ncz\r\ncz tgPYZk\r\nrJGeodBycK adQx\r\n', 'output': ['2\r\nadQx\r\ncz\r\n']}, {'input': '4 2\r\noVemoZhjW\r\nHspFEry\r\nhFO\r\njxt\r\nhFO HspFEry\r\njxt oVemoZhjW\r\n', 'output': ['2\r\nHspFEry\r\njxt\r\n']}, {'input': '5 2\r\niBrgNFlNXd\r\nlnGPIV\r\nnb\r\nB\r\nVgqRcEOG\r\nlnGPIV iBrgNFlNXd\r\nB iBrgNFlNXd\r\n', 'output': ['4\r\nB\r\nVgqRcEOG\r\nlnGPIV\r\nnb\r\n']}, {'input': '5 1\r\nWEYUdpYmZp\r\nfhNmMpjr\r\nydARivBg\r\ncilTtE\r\nyeXxkhPzB\r\nyeXxkhPzB cilTtE\r\n', 'output': ['4\r\nWEYUdpYmZp\r\ncilTtE\r\nfhNmMpjr\r\nydARivBg\r\n']}, {'input': '6 9\r\noySkmhCD\r\nUIKWj\r\nmHolKkBx\r\nQBikssqz\r\nZ\r\nzoFUJYa\r\nZ UIKWj\r\nQBikssqz oySkmhCD\r\nQBikssqz UIKWj\r\nZ oySkmhCD\r\nzoFUJYa UIKWj\r\nzoFUJYa Z\r\nzoFUJYa mHolKkBx\r\nzoFUJYa QBikssqz\r\nQBikssqz mHolKkBx\r\n', 'output': ['3\r\nUIKWj\r\nmHolKkBx\r\noySkmhCD\r\n']}, {'input': '6 1\r\nuPVIuLBuYM\r\nVejWyKCtbN\r\nqqjgF\r\nulBD\r\nDRNzxJU\r\nCOzbXWOt\r\nulBD qqjgF\r\n', 'output': ['5\r\nCOzbXWOt\r\nDRNzxJU\r\nVejWyKCtbN\r\nqqjgF\r\nuPVIuLBuYM\r\n']}, {'input': '7 14\r\nFXCT\r\nn\r\no\r\nS\r\nMdFuonu\r\nmszv\r\nbqScOCw\r\nS o\r\nbqScOCw FXCT\r\nMdFuonu o\r\no n\r\nbqScOCw n\r\nmszv S\r\nbqScOCw MdFuonu\r\nmszv n\r\nS FXCT\r\nbqScOCw o\r\no FXCT\r\nmszv MdFuonu\r\nmszv FXCT\r\nbqScOCw mszv\r\n', 'output': ['3\r\nFXCT\r\nMdFuonu\r\nn\r\n']}, {'input': '7 6\r\nj\r\nZ\r\nPZNeTyY\r\nm\r\na\r\nUj\r\nsuaaSiKcK\r\nUj PZNeTyY\r\na j\r\nPZNeTyY Z\r\nPZNeTyY j\r\nm PZNeTyY\r\nm j\r\n', 'output': ['5\r\nUj\r\nZ\r\na\r\nm\r\nsuaaSiKcK\r\n']}, {'input': '8 6\r\nU\r\nC\r\nPEElYwaxf\r\nVubTXNI\r\nJ\r\nIxZUHV\r\nhLNFnzmqFE\r\nDPPvwuWvmA\r\nhLNFnzmqFE IxZUHV\r\nIxZUHV C\r\nJ PEElYwaxf\r\nIxZUHV PEElYwaxf\r\nPEElYwaxf C\r\nJ VubTXNI\r\n', 'output': ['5\r\nC\r\nDPPvwuWvmA\r\nJ\r\nU\r\nhLNFnzmqFE\r\n']}, {'input': '8 12\r\nBkgxqAF\r\nKhq\r\nNpIfk\r\nkheqUyDVG\r\niRBkHlRpp\r\nZDaQY\r\nNG\r\nqN\r\nqN BkgxqAF\r\nNpIfk BkgxqAF\r\niRBkHlRpp BkgxqAF\r\niRBkHlRpp NpIfk\r\nNG Khq\r\niRBkHlRpp Khq\r\nNG ZDaQY\r\nNG iRBkHlRpp\r\nNG NpIfk\r\nqN Khq\r\nZDaQY kheqUyDVG\r\nNpIfk Khq\r\n', 'output': ['3\r\nBkgxqAF\r\nKhq\r\nZDaQY\r\n']}, {'input': '9 5\r\nRFiow\r\naxgvtiBGbx\r\ngGBVZtI\r\nVWAxrqx\r\nmnASVEQI\r\ntZHzWGAvXc\r\nBeaCYhIRLy\r\nhTdUL\r\nFJd\r\nhTdUL RFiow\r\nhTdUL gGBVZtI\r\nFJd axgvtiBGbx\r\nFJd BeaCYhIRLy\r\nhTdUL axgvtiBGbx\r\n', 'output': ['7\r\nBeaCYhIRLy\r\nRFiow\r\nVWAxrqx\r\naxgvtiBGbx\r\ngGBVZtI\r\nmnASVEQI\r\ntZHzWGAvXc\r\n']}, {'input': '9 13\r\nYiUXqlBUx\r\nQNgYuX\r\ndPtyZ\r\nITtwRJCv\r\nLJ\r\nrAG\r\nOgxNq\r\nsitechE\r\nvVAAz\r\nOgxNq QNgYuX\r\nOgxNq dPtyZ\r\nsitechE rAG\r\nLJ QNgYuX\r\nQNgYuX YiUXqlBUx\r\nOgxNq LJ\r\nvVAAz OgxNq\r\nrAG dPtyZ\r\nvVAAz LJ\r\nvVAAz ITtwRJCv\r\nsitechE LJ\r\nrAG YiUXqlBUx\r\nsitechE QNgYuX\r\n', 'output': ['4\r\nITtwRJCv\r\nLJ\r\nYiUXqlBUx\r\ndPtyZ\r\n']}, {'input': '9 6\r\nfLfek\r\nEQPcotnrp\r\nCaAlbwoIL\r\nVG\r\nNAZKIBiKT\r\noFy\r\njFluh\r\nKqHXRNya\r\nQSwgobA\r\noFy EQPcotnrp\r\nKqHXRNya jFluh\r\noFy NAZKIBiKT\r\njFluh oFy\r\njFluh fLfek\r\noFy fLfek\r\n', 'output': ['7\r\nCaAlbwoIL\r\nEQPcotnrp\r\nKqHXRNya\r\nNAZKIBiKT\r\nQSwgobA\r\nVG\r\nfLfek\r\n']}, {'input': '9 14\r\nmoRNeufngu\r\nBSKI\r\nzXl\r\ngwmIDluW\r\nYFn\r\nHvasEgl\r\nXcAC\r\neVP\r\nAiOm\r\neVP BSKI\r\neVP YFn\r\nHvasEgl YFn\r\neVP XcAC\r\nAiOm HvasEgl\r\nXcAC YFn\r\nzXl moRNeufngu\r\neVP zXl\r\nHvasEgl BSKI\r\nXcAC gwmIDluW\r\nXcAC HvasEgl\r\nYFn moRNeufngu\r\nzXl BSKI\r\nHvasEgl gwmIDluW\r\n', 'output': ['4\r\nAiOm\r\nBSKI\r\nYFn\r\ngwmIDluW\r\n']}, {'input': '15 8\r\ncXeOANpvBF\r\nbkeDfi\r\nnsEUAKNxQI\r\noSIb\r\naU\r\nXYXYVo\r\nduZQ\r\naPkr\r\nPVrHpL\r\nmVgmv\r\nhHhukllwbf\r\nGkNPGYVxjY\r\nbgBjA\r\nslNKCLIlOv\r\nmPILXy\r\nbgBjA cXeOANpvBF\r\nGkNPGYVxjY cXeOANpvBF\r\nslNKCLIlOv GkNPGYVxjY\r\nGkNPGYVxjY mVgmv\r\nXYXYVo cXeOANpvBF\r\nslNKCLIlOv bkeDfi\r\nmVgmv aPkr\r\nslNKCLIlOv nsEUAKNxQI\r\n', 'output': ['12\r\nGkNPGYVxjY\r\nPVrHpL\r\nXYXYVo\r\naPkr\r\naU\r\nbgBjA\r\nbkeDfi\r\nduZQ\r\nhHhukllwbf\r\nmPILXy\r\nnsEUAKNxQI\r\noSIb\r\n']}, {'input': '15 3\r\na\r\nYclKFJoaIA\r\nhalYcB\r\nbLOlPzAeQ\r\ntckjt\r\noDFijpx\r\nb\r\npz\r\nVDLb\r\nlCEHPibt\r\noF\r\npzJD\r\nMC\r\nqklsX\r\nTAU\r\npzJD tckjt\r\nqklsX oF\r\nMC p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\r\nJwZWx xDwpppG\r\nFJYX JwZWx\r\n', 'output': ['8\r\nD\r\nEr\r\nJwZWx\r\nMDuBOXrmWH\r\nPaJNrF\r\nSgjMQZ\r\nZ\r\naHtRqSxOO\r\n']}, {'input': '16 37\r\ntIWi\r\nq\r\nIEAYCq\r\nXozwkum\r\nCC\r\niPwfd\r\nS\r\nXEf\r\nWqEiwkH\r\nWX\r\ne\r\nltmruh\r\nKGx\r\nauTUYZRC\r\nmeJa\r\nM\r\nmeJa q\r\nKGx e\r\nXEf Xozwkum\r\ne q\r\nauTUYZRC KGx\r\ne CC\r\nM CC\r\nM meJa\r\nWX CC\r\nWqEiwkH IEAYCq\r\nauTUYZRC WqEiwkH\r\nKGx WX\r\nmeJa KGx\r\nXEf q\r\nauTUYZRC XEf\r\nauTUYZRC IEAYCq\r\nWX XEf\r\nM XEf\r\nWqEiwkH q\r\nM KGx\r\nKGx CC\r\nM e\r\nWqEiwkH Xozwkum\r\nCC q\r\nS Xozwkum\r\nKGx tIWi\r\nWX q\r\nXEf S\r\nauTUYZRC S\r\nCC IEAYCq\r\nKGx IEAYCq\r\ne WqEiwkH\r\nM S\r\nauTUYZRC q\r\nS tIWi\r\nM ltmruh\r\nM iPwfd\r\n', 'output': ['8\r\nIEAYCq\r\nWX\r\nXozwkum\r\ne\r\niPwfd\r\nltmruh\r\nmeJa\r\ntIWi\r\n']}, {'input': '16 11\r\ntulhZxeKgo\r\nbrAXY\r\nyQUkaihDAg\r\nmwjlDVaktK\r\nweVtBIP\r\nzRwb\r\nds\r\nhXPfJrL\r\nAdIfP\r\nazQeXn\r\nB\r\nJlmscIUOxO\r\nZuxr\r\nV\r\nOfyLIUO\r\nuaMl\r\nhXPfJrL yQUkaihDAg\r\nweVtBIP yQUkaihDAg\r\nazQeXn hXPfJrL\r\nV tulhZxeKgo\r\nzRwb yQUkaihDAg\r\nds mwjlDVaktK\r\nzRwb brAXY\r\nyQUkaihDAg brAXY\r\nB yQUkaihDAg\r\nAdIfP mwjlDVaktK\r\nbrAXY tulhZxeKgo\r\n', 'output': ['11\r\nAdIfP\r\nB\r\nJlmscIUOxO\r\nOfyLIUO\r\nV\r\nZuxr\r\nazQeXn\r\nbrAXY\r\nds\r\nuaMl\r\nweVtBIP\r\n']}, {'input': '5 10\r\nTaras\r\nNikita\r\nSergey\r\nAndrey\r\nRomka\r\nTaras Romka\r\nTaras Nikita\r\nTaras Sergey\r\nTaras Andrey\r\nRomka Nikita\r\nRomka Sergey\r\nRomka Andrey\r\nNikita Sergey\r\nNikita Andrey\r\nSergey Andrey\r\n', 'output': ['1\r\nAndrey\r\n']}]


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

namespace codeforces_43_B
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetIn(new StreamReader("input.txt"));
            StringBuilder letter = new StringBuilder(Console.ReadLine().Trim());
            StringBuilder message = new StringBuilder(Console.ReadLine().Trim());

            Dictionary<char, uint> dict = new Dictionary<char, uint>();
            int i = -1;
            while (i < letter.Length-1)
            {
                i++;
                if (letter[i] == ' ')
                    continue;
                char curChar = letter[i];
                if (dict.ContainsKey(curChar))
                {
                    dict[curChar]++;
                }
                else
                {
                    dict.Add(curChar, 0);
                }
            }
            bool canWrite = true;
            int j = -1;
            while (j < message.Length-1)
            {
                j++;
                if (message[j] == ' ')
                    continue;
                char curChar = message[j];
                if (!dict.ContainsKey(curChar))
                {
                    canWrite = false;
                    break;
                }
                else
                {
                    dict[curChar]--;
                }
            }
            foreach (char curChar in dict.Keys)
                if (dict[curChar] < 0)
                {
                    canWrite = false;
                    break;
                }
            Console.Write((canWrite) ? "YES" : "NO");
            Console.ReadKey();
        }
    }
}

Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading — he just leaves some blank space to mark them. Help him; find out if he will manage to compose the needed text.

The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 и s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of the heading.

If Vasya can write the given anonymous letter, print YES, otherwise print NO

Instead of dogging Your footsteps it disappears but you dont notice anything
where is your dog

Instead of dogging Your footsteps it disappears but you dont notice anything
Your dog is upstears

Instead of dogging your footsteps it disappears but you dont notice anything
Your dog is upstears

using System;

namespace problems
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] s1 = Console.ReadLine().ToCharArray(), s2 = Console.ReadLine().ToCharArray();
            string res = string.Empty;
            for (int i = 0; i < s2.Length; i++)
            {
                if (s2[i] != ' ')
                {
                    for (int y = 0; y < s1.Length; y++)
                    {
                        if (s2[i] == s1[y]) { s1[y] = ' '; res = "YES"; break; }
                        else { res = "NO"; }
                    }
                    if (res.Equals("NO")) break;
                }
            }
            Console.WriteLine(res.Equals("NO") ? res : "YES");
        }
    }
}

[{'input': 'Instead of dogging Your footsteps it disappears but you dont notice anything\r\nwhere is your dog\r\n', 'output': ['NO\r\n']}, {'input': 'Instead of dogging Your footsteps it disappears but you dont notice anything\r\nYour dog is upstears\r\n', 'output': ['YES\r\n']}, {'input': 'Instead of dogging your footsteps it disappears but you dont notice anything\r\nYour dog is upstears\r\n', 'output': ['NO\r\n']}, {'input': 'abcdefg hijk\r\nk j i h g f e d c b a\r\n', 'output': ['YES\r\n']}, {'input': 'HpOKgo\r\neAtAVB\r\n', 'output': ['NO\r\n']}, {'input': 'GRZGc\r\nLPzD\r\n', 'output': ['NO\r\n']}, {'input': 'GtPXu\r\nd\r\n', 'output': ['NO\r\n']}, {'input': 'FVF\r\nr \r\n', 'output': ['NO\r\n']}, {'input': 'HpOKgo\r\nogK\r\n', 'output': ['YES\r\n']}, {'input': 'GRZGc\r\nZG\r\n', 'output': ['YES\r\n']}, {'input': 'HpOKgoueAtAVBdGffvQheJDejNDHhhwyKJisugiRAH OseK yUwqPPNuThUxTfthqIUeb wS jChGOdFDarNrKRT  MlwKecxWNoKEeD BbiHAruE XMlvKYVsJGPP\r\nAHN  XvoaNwV  AVBKwKjr u      U K wKE D K   Jy KiHsR h d W  Js IHyMPK Br iSqe  E fDA   g H\r\n', 'output': ['YES\r\n']}, {'input': 'GRZGcsLPzDrCSXhhNTaibJqVphhjbcPoZhCDUlzAbDnRWjHvxLKtpGiFWiGbfeDxBwCrdJmJGCGv GebAOinUsFrlqKTILOmxrFjSpEoVGoTdSSstJWVgMLKMPettxHASaQZNdOIObcTxtF qTHWBdNIKwj\r\nWqrxze Ji x q aT GllLrRV jMpGiMDTwwS JDsPGpAZKACmsFCOS CD Sj  bCDgKF  jJxa RddtLFAi VGLHH SecObzG q  hPF \r\n', 'output': ['YES\r\n']}, {'input': 'GtPXuwdAxNhODQbjRslDDKciOALJrCifTjDQurQEBeFUUSZWwCZQPdYwZkYbrduMijFjgodAOrKIuUKwSXageZuOWMIhAMexyLRzFuzuXqBDTEaWMzVdbzhxDGSJC SsIYuYILwpiwwcObEHWpFvHeBkWYNitqYrxqgHReHcKnHbtjcWZuaxPBVPb\r\nTQIKyqFaewOkY lZUOOuxEw EwuKcArxRQGFYkvVWIAe SuanPeHuDjquurJu aSxwgOSw jYMwjxItNUUArQjO BIujAhSwttLWp\r\n', 'output': ['YES\r\n']}, {'input': 'FVFSr unvtXbpKWF vPaAgNaoTqklzVqiGYcUcBIcattzBrRuNSnKUtmdGKbjcE\r\nUzrU K  an GFGR        Wc zt iBa     P c    T K v p     V In   b           B   c\r\n', 'output': ['YES\r\n']}, {'input': 'lSwjnYLYtDNIZjxHiTawdh ntSzggZogcIZTuiTMWVgwyloMtEhqkrOxgIcFvwvsboXUPILPIymFAEXnhApewJXJNtFyZ\r\nAoxe  jWZ u  yImg  o AZ FNI w lpj  tNhT g y  ZYcb rc J    w Dlv\r\n', 'output': ['YES\r\n']}, {'input': 'kvlekcdJqODUKdsJlXkRaileTmdGwUHWWgvgUokQxRzzbpFnswvNKiDnjfOFGvFcnaaiRnBGQmqoPxDHepgYasLhzjDgmvaFfVNEcSPVQCJKAbSyTGpXsAjIHr\r\nGjzUllNaGGKXUdYmDFpqFAKIwvTpjmqnyswWRTnxlBnavAGvavxJemrjvRJc\r\n', 'output': ['YES\r\n']}, {'input': 'kWbvhgvvoYOhwXmgTwOSCDXrtFHhqwvMlCvsuuAUXMmWaYXiqHplFZZemhgkTuvsUtIaUxtyYauBIpjdbyYxjZ ZkaBPzwqPfqF kCqGRmXvWuabnQognnkvdNDtRUsSUvSzgBuxCMBWJifbxWegsknp\r\nBsH   bWHJD n Ca T xq  PRCv  tatn Wjy sm  I q s WCjFqdWe  t W XUs  Do  eb Pfh ii  hTbF  O Fll\r\n', 'output': ['YES\r\n']}, {'input': 'OTmLdkMhmDEOMQMiW ZpzEIjyElHFrNCfFQDp SZyoZaEIUIpyCHfwOUqiSkKtFHggrTBGkqfOxkChPztmPrsHoxVwAdrxbZLKxPXHlMnrkgMgiaHFopiFFiUEtKwCjpJtwdwkbJCgA bxeDIscFdmHQJLAMNhWlrZisQrHQpvbALWTwpf jnx\r\nDbZwrQbydCdkJMCrftiwtPFfpMiwwrfIrKidEChKECxQUBVUEfFirbGWiLkFQkdJiFtkrtkbIAEXCEDkwLpK\r\n', 'output': ['YES\r\n']}, {'input': 'NwcGaIeSkOva\r\naIa\r\n', 'output': ['YES\r\n']}, {'input': 'gSrAcVYgAdbdayzbKGhIzLDjyznLRIJH KyvilAaEddmgkBPCNzpmPNeGEbmmpAyHvUSoPvnaORrPUuafpReEGoDOQsAYnUHYfBqhdcopQfxJuGXgKnbdVMQNhJYkyjiJDKlShqBTtnnDQQzEijOMcYRGMgPGVhfIReYennKBLwDTVvcHMIHMgVpJkvzTrezxqS\r\nHJerIVvRyfrPgAQMTI AqGNO mQDfDwQHKgeeYmuRmozKHILvehMPOJNMRtPTAfvKvsoGKi xHEeKqDAYmQJPUXRJbIbHrgVOMGMTdvYiLui\r\n', 'output': ['YES\r\n']}, {'input': 'ReB hksbHqQXxUgpvoNK bFqmNVCEiOyKdKcAJQRkpeohpfuqZabvrLfmpZOMcfyFBJGZwVMxiUPP pbZZtJjxhEwvrAba\r\nJTCpQnIViIGIdQtLnmkVzmcbBZR CoxAdTtWSYpbOglDFifqIVQ vfGKGtLpxpJHiHSWCMeRcrVOXBGBhoEnVhNTPWGTOErNtSvokcGdgZXbgTEtISUyTwaXUEIlJMmutsdCbiyrPZPJyRdOjnSuAGttLy\r\n', 'output': ['NO\r\n']}, {'input': 'hrLzRegCuDGxTrhDgVvM KowwyYuXGzIpcXdSMgeQVfVOtJZdkhNYSegwFWWoPqcZoeapbQnyCtojgkcyezUNHGGIZrhzsKrvvcrtokIdcnqXXkCNKjrOjrnEAKBNxyDdiMVeyLvXxUYMZQRFdlcdlcxzKTeYzBlmpNiwWbNAAhWkMoGpRxkCuyqkzXdKWwGH\r\nJESKDOfnFdxPvUOCkrgSBEPQHJtJHzuNGstRbTCcchRWJvCcveSEAtwtOmZZiW\r\n', 'output': ['NO\r\n']}, {'input': 'yDBxCtUygQwWqONxQCcuAvVCkMGlqgC zvkfEkwqbhMCQxnkwQIUhucCbVUyOBUcXvTNEGriTBwMDMfdsPZgWRgIUDqM\r\neptVnORTTyixxmWIBpSTEwOXqGZllBgSxPenYCDlFwckJlWsoVwWLAIbPOmFqcKcTcoQqahetl KLfVSyaLVebzsGwPSVbtQAeUdZAaJtfxlCEvvaRhLlVvRJhKat IaB awdqcDlrrhTbRxjEbzGwcdmdavkhcjHjzmwbxAgw\r\n', 'output': ['NO\r\n']}, {'input': 'jlMwnnotSdlQMluKWkJwAeCetcqbIEnKeNyLWoKCGONDRBQOjbkGpUvDlmSFUJ bWhohqmmIUWTlDsvelUArAcZJBipMDwUvRfBsYzMdQnPDPAuBaeJmAxVKwUMJrwMDxNtlrtAowVWqWiwFGtmquZAcrpFsLHCrvMSMMlvQUqypAihQWrFMNoaqfs IBg\r\nNzeWQ bafrmDsYlpNHSGTBBgPl WIcuNhyNaNOEFvL\r\n', 'output': ['NO\r\n']}, {'input': 'zyWvXBcUZqGqjHwZHQryBtFliLYnweXAoMKNpLaunaOlzaauWmLtywsEvWPiwxJapocAFRMjrqWJXYqfKEbBKnzLO\r\npsbi bsXpSeJaCkIuPWfSRADXdIClxcDCowwJzGCDTyAl\r\n', 'output': ['NO\r\n']}, {'input': 'kKhuIwRPLCwPFfcnsyCfBdnsraGeOCcLTfXuGjqFSGPSAeDZJSS bXKFanNqWjpFnvRpWxHJspvisDlADJBioxXNbVoXeUedoPcNEpUyEeYxdJXhGzFAmpAiHotSVwbZQsuWjIVhVaEGgqbZHIoDpiEmjTtFylCwCkWWzUOoUfOHxEZvDwNpXhBWamHn\r\nK VpJjGhNbwCRhcfmNGVjewBFpEmPlIKeTuWiukDtEWpjgqciqglkyNfWrBLbGAKvlNWxaUelJmSlSoakSpRzePvJsshOsTYrMPXdxKpaShjyVIXGhRIAdtiGpNwtiRmGTBZhkJqIMdxMHX RMxCMYcWjcjhtCHyFnCvjjezGbkRDRiVxkbh\r\n', 'output': ['NO\r\n']}, {'input': 'AXssNpFKyQmJcBdBdfkhhMUzfqJVgcLBddkwtnFSzSRUCjiDcdtmkzIGkCKSxWUEGhmHmciktJyGMkgCductyHx\r\nI nYhmJfPnvoKUiXYUBIPIcxNYTtvwPUoXERZvY ahlDpQFNMmVZqEBiYqYlHNqcpSCmhFczBlOAhsYFeqMGfqL EJsDNOgwoJfBzqijKOFcYQ\r\n', 'output': ['NO\r\n']}, {'input': 'lkhrzDZmkdbjzYKPNMRkiwCFoZsMzBQMnxxdKKVJezSBjnLjPpUYtabcPTIaDJeDEobbWHdKOdVfMQwDXzDDcSrwVenDEYpMqfiOQ xSsqApWnAMoyhQXCKFzHvvzvUvkWwmwZrvZz\r\nsUzGspYpRFsHRbRgTQuCBgnFgPkisTUfFNwyEEWWRiweWWgjRkVQxgTwxOzdsOwfrGIH O gCXpzvHzfItuEHaihmugEyymSJIogYwX qAwcwIItidfnzZDhZgQHi eRjMAeVkJHceDZuJkmxGowOsmcGYYvk Ajtgi TxwihvjLViNZjvscTWvsaQUelTSivLShhEl\r\n', 'output': ['NO\r\n']}, {'input': 'BRsVjyNhrqRHVwrJzuzRigEhdpbDmaACSPfed\r\nlWqKTjlrqOCUbgBBZdZDGCeQJDXawPnnDkQdZDgwrEQk\r\n', 'output': ['NO\r\n']}, {'input': 'KRmINuyBYPwiTsdlyiNVuylToysJKmOpcLovAtwGPqrgFJQNAYvuAiyQRkeFMECVZvkDEmTauXlyjAaYRnTJXORMZRnTakBaUzSelMilejySDIZjQjzcOIrwXdvDvpeRIkoBgreyFXIyyIZutjiEBtwrmzQtPVUhvvdEtDMbXjBpoPVjGdM EXTAK JbCnw\r\nXZZqlJvzKKtvdNlzFPDTYxidqlsgufVzyEmO FZuLQ vVQsJESNviUCovCK NwwlbxsmPtOJNmAonCqrOZ bZ LVKAsQGmoLnYjeekvEIECFk\r\n', 'output': ['NO\r\n']}]


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

namespace AcmSolution
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            //Console.SetIn(new StreamReader("gcd.in"));
           // Console.SetOut(new StreamWriter("gcd.out"));
            Do();
            //Console.Out.Close();
            Console.ReadLine();
        }

        private static void Do()
        {
            int n = GetInt();
            int[] a = GetInts();
            Array.Sort(a);
            int subNumbers = 0;

            if (n == 1 && a[0] > n)
                subNumbers = 1;

            for (int i = 0; i < n; i++)
            {
                if (a[i]> n)
                {
                    subNumbers++;
                }
                else if (i > 0 && a[i] == a[i - 1])
                    subNumbers++;
            }

            Console.WriteLine(subNumbers);
        }

        #region Utils
        private const double Epsilon = 0.00000001;

        private static string GetStr()
        {
            return Console.ReadLine();
        }

        private static string[] GetStrs()
        {
            return GetStr().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] GetStrs(int cnt)
        {
            var s = new string[cnt];
            for (var i = 0; i < cnt; ++i)
                s[i] = GetStr();
            return s;
        }

        private static int GetInt()
        {
            return int.Parse(GetStr());
        }

        private static void GetInts(out int a, out int b)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
        }

        private static void GetInts(out int a, out int b, out int c)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
            c = q[2];
        }

        private static int[] GetInts()
        {
            var s = GetStrs();
            var a = new int[s.Length];
            for (var i = 0; i < s.Length; ++i)
                a[i] = int.Parse(s[i]);
            return a;
        }

        private static long GetLong()
        {
            return long.Parse(GetStr());
        }

        private static IEnumerable<long> GetLongs()
        {
            return GetStrs().Select(long.Parse);
        }

        private static void WriteDouble<T>(T d)
        {
            Console.WriteLine(string.Format("{0:0.000000000}", d).Replace(',', '.'));
        }

        private static void WL<T>(T s)
        {
            Console.WriteLine(s);
        }

        private static void W<T>(T s)
        {
            Console.Write(s);
        }

        private static void Assert(bool b)
        {
            if (!b) throw new Exception();
        }

        private static void Swap<T>(ref T a, ref T b)
        {
            var temp = a;
            a = b;
            b = temp;
        }

        #endregion
    }
}

"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once.You are given an arbitrary sequence a1, a2, ..., an containing n integers. Each integer is not less than 1 and not greater than 5000. Determine what minimum number of elements Polycarpus needs to change to get a permutation (he should not delete or add numbers). In a single change he can modify any single sequence element (i. e. replace it with another integer).

The first line of the input data contains an integer n (1 ≤ n ≤ 5000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1 ≤ ai ≤ 5000, 1 ≤ i ≤ n).

Print the only number — the minimum number of changes needed to get the permutation.

NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with number 2.

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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] a = new int[n];
            Input(a);
            Array.Sort(a);
            int count = 0;
            Array.BinarySearch(a, 1);
            for (int i = 0; i < a.Length; i++)
            {
                if (Array.BinarySearch(a, i + 1) < 0)
                    count++;
            }
            Console.WriteLine(count);
        }
        static void Input(int[] l)
        {
            var input = Console.ReadLine().Split();
            for (int j = 0; j < input.Length; j++)
            {
                l[j] = Convert.ToInt32(input[j]);
            }
        }
    }
}


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

namespace Коттеджный_городок
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]), t = int.Parse(str[1]);
            int[,] mas = new int[n,2];
            for (int i = 0; i < n; i++)
            {
                str = Console.ReadLine().Split(' ');
                mas[i, 0] = int.Parse(str[0]);
                mas[i, 1] = int.Parse(str[1]);
            }
            for(int i=0;i<n-1;i++)
                for(int j=0;j<n-i-1;j++)
                    if (mas[j, 0] > mas[j + 1, 0])
                    {
                        mas[j,0] += mas[j + 1,0];
                        mas[j, 1] += mas[j + 1, 1];
                        mas[j + 1, 0] = mas[j, 0] - mas[j + 1, 0];
                        mas[j + 1, 1] = mas[j, 1] - mas[j + 1, 1];
                        mas[j, 0] -= mas[j + 1, 0];
                        mas[j, 1] -= mas[j + 1, 1];
                    }
            int ans = 2;
            for (int i = 0; i < n-1; i++)
            {
                if (((mas[i + 1, 0] - mas[i + 1, 1] / 2) - (mas[i, 0] + mas[i, 1] / 2)) > t)
                    ans += 2;
                if (((mas[i + 1, 0] - mas[i + 1, 1] / 2) - (mas[i, 0] + mas[i, 1] / 2)) == t)
                    ans++;

            }
            Console.WriteLine(ans);
        }
    }
}

A new cottage village called «Flatville» is being built in Flatland. By now they have already built in «Flatville» n square houses with the centres on the Оx-axis. The houses' sides are parallel to the coordinate axes. It's known that no two houses overlap, but they can touch each other.The architect bureau, where Peter works, was commissioned to build a new house in «Flatville». The customer wants his future house to be on the Оx-axis, to be square in shape, have a side t, and touch at least one of the already built houses. For sure, its sides should be parallel to the coordinate axes, its centre should be on the Ox-axis and it shouldn't overlap any of the houses in the village.Peter was given a list of all the houses in «Flatville». Would you help him find the amount of possible positions of the new house?

The first line of the input data contains numbers n and t (1 ≤ n, t ≤ 1000). Then there follow n lines, each of them contains two space-separated integer numbers: xi ai, where xi — x-coordinate of the centre of the i-th house, and ai — length of its side ( - 1000 ≤ xi ≤ 1000, 1 ≤ ai ≤ 1000).

Output the amount of possible positions of the new house.

NoteIt is possible for the x-coordinate of the new house to have non-integer value.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
static class P {
    static int[] ToIntArray(this string val) { return val.Split().Select(int.Parse).ToArray(); }
    static void Main() {
        var line = Console.ReadLine().ToIntArray();
        int n = line[0], t = line[1], i = 0, cnt = 0;
        var list = new SortedList<int, int>();
        for (; i < n; ++i) {
            var input = Console.ReadLine().ToIntArray();
            list.Add(input[0], input[1]);
        }

        IList<int> keys = list.Keys, values = list.Values;
        for (i = 0; i < n - 1; ++i) {
            var val = (keys[i + 1] - keys[i]) - ((values[i + 1] + values[i]) / 2.0);
            if (val > t) { cnt += 2; } else if (val == t) { cnt++; }
        }
        Console.Write(cnt + 2);
    }
}