Language: C++

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



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

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



    static void Solve()
    {
        Scan sc = new Scan();
        write wr = new write();


        var N = sc.intarr[0];
        var S = sc.str;
        int kuro = 0;
        for(int i = 0; i < N; ++i)
        {
            if (S[i] == '#') kuro++;
        }

        if (S[N - 1] == '#')
        {
            wr.wri(kuro - 1);
        }
        else wr.wri(Math.Min(kuro,N-kuro));




    }
}
    




class Scan
{
        public string str => Console.ReadLine();

        public string[] strarr => str.Split(' ');

        public long[] longarr => strarr.Select(long.Parse).ToArray();
        public int[] intarr => strarr.Select(int.Parse).ToArray();
    public char[] chararr => str.ToArray();


}



class write
{
    public void wri<Type>(Type x)
    {
        Console.WriteLine(x);
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Threading.Tasks;
      |       ^~~~~~
a.cc:14:22: error: 'string' has not been declared
   14 |     static void Main(string[] args)
      |                      ^~~~~~
a.cc:14:31: error: expected ',' or '...' before 'args'
   14 |     static void Main(string[] args)
      |                               ^~~~
a.cc:45:2: error: expected ';' after class definition
   45 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Program::Solve()':
a.cc:23:9: error: 'Scan' was not declared in this scope
   23 |         Scan sc = new Scan();
      |         ^~~~
a.cc:24:9: error: 'write' was not declared in this scope
   24 |         write wr = new write();
      |         ^~~~~
a.cc:27:9: error: 'var' was not declared in this scope
   27 |         var N = sc.intarr[0];
      |         ^~~
a.cc:28:13: error: expected ';' before 'S'
   28 |         var S = sc.str;
      |             ^
a.cc:30:28: error: 'N' was not declared in this scope
   30 |         for(int i = 0; i < N; ++i)
      |                            ^
a.cc:32:17: error: 'S' was not declared in this scope
   32 |             if (S[i] == '#') kuro++;
      |                 ^
a.cc:35:13: error: 'S' was not declared in this scope
   35 |         if (S[N - 1] == '#')
      |             ^
a.cc:35:15: error: 'N' was not declared in this scope
   35 |         if (S[N - 1] == '#')
      |               ^
a.cc:37:13: error: 'wr' was not declared in this scope
   37 |             wr.wri(kuro - 1);
      |             ^~
a.cc:39:14: error: 'wr' was not declared in this scope
   39 |         else wr.wri(Math.Min(kuro,N-kuro));
      |              ^~
a.cc:39:21: error: 'Math' was not declared in this scope
   39 |         else wr.wri(Math.Min(kuro,N-kuro));
      |                     ^~~~
a.cc: At global scope:
a.cc:53:15: error: expected ':' before 'string'
   53 |         public string str => Console.ReadLine();
      |               ^~~~~~~
      |               :
a.cc:53:16: error: 'string' does not name a type
   53 |         public string str => Console.ReadLine();
      |                ^~~~~~
a.cc:55:15: error: expected ':' before 'string'
   55 |         public string[] strarr => str.Split(' ');
      |               ^~~~~~~
      |               :
a.cc:55:16: error: 'string' does not name a type
   55 |         public string[] strarr => str.Split(' ');
      |                ^~~~~~
a.cc:57:15: error: expected ':' before 'long'
   57 |         public long[] longarr => strarr.Select(long.Parse).ToArray();
      |               ^~~~~
      |               :
a.cc:57:20: error: expected unqualified-id before '[' token
   57 |         public long[] longarr => strarr.Select(long.Parse).ToArray();
      |                    ^
a.cc:58:15: error: expected ':' before 'int'
   58 |         public int[] intarr => strarr.Select(int.Parse).ToArray();
      |               ^~~~
      |               :
a.cc:58:19: error: expected unqualified-id before '[' token
   58 |         public int[] intarr => strarr.Select(int.Parse).ToArray();
      |                   ^
a.cc:59:11: error: expected ':' before 'char'
   59 |     public char[] chararr => str.ToArray();
      |           ^~~~~
      |           :
a.cc:59:16: error: expected unqualified-id before '[' token
   59 |     public char[] chararr => str.ToArray();
      |                ^
a.cc:62:2: error: expected ';' after class definition
   62 | }
      |  ^
      |  ;
a.cc:68:11: error: expected ':' before 'void'
   68 |     public void wri<Type>(Type x)
      |           ^~~~~
      |           :
a.cc:68:17: error: variable or field 'wri' declared void
   68 |     public void wri<Type>(Type x)
      |                 ^~~
a.cc:68:17: error: expected ';' at end of member declaration
   68 |     public void wri<Type>(Type x)
      |                 ^~~
      |                    ;
a.cc:68:20: error: expected unqualified-id before '<' token
   68 |     public void wri<Type>(Type x)
      |                    ^
a.cc:72:2: error: expected ';' after class definition
   72 | }
      |  ^
      |  ;