using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace test_2 { class Program { static void Main(string[] args) { string[] n = Console.ReadLine().Split(); int s = int.Parse(n[0]); int count = 0; for(int i = 1; i <= Math.Pow(10,s); i++) { if(i%3 == 0) { count++; } else if (i.ToString().Contains("3")) { count++; } } Console.WriteLine(count); } } }