import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[201];
		sum[1] = 1;
		for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		}
		System.out.println(sum[n]);
	}

	private static int gcd(int a, int b) {
//		      辗转相减法
      while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      }
      return b;
	}


	private static int gcd(int a, int b, int c) {
		int gcd1 = gcd(a,b);
		return gcd(gcd1, c);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[201];
		sum[1] = 1;
		for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		}
		System.out.println(sum[n]);
	}

	private static int gcd(int a, int b) {
//		      辗转相减法
      while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      }
      return b;
	}


	private static int gcd(int a, int b, int c) {
		int gcd1 = gcd(a,b);
		return gcd(gcd1, c);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[201];
		sum[1] = 1;
		for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		}
		System.out.println(sum[n]);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[201];
		sum[1] = 1;
		for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		}
		System.out.println(sum[n]);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] sum = new int[201]; sum new int[201] 201 sum[1] = 1 sum[1] sum 1 1 for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		} int i = 2; int i = 2; i 2 i <= n i n i++ i++ i {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		} {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		} sum[i]+= sum[i-1] sum[i] sum i sum[i-1] sum i-1 i 1 for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			} int j = 1; int j = 1; j 1 j <= i j i j++ j++ j {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			} {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			} for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				} int k = 1; int k = 1; k 1 k <= i k i k++ k++ k {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				} {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				} for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					} int l = 1; int l = 1; l 1 l <= i l i l++ l++ l {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					} {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					} if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						} j == i || k == i || l ==i j == i || k == i || l ==i j == i j i k == i k i l ==i l i {
							sum[i] += gcd(j,k,l);
						} sum[i] += gcd(j,k,l) sum[i] sum i gcd(j,k,l) gcd j k l System.out.println(sum[n]) System.out.println System.out System System.out sum[n] sum n String[] args args private static int gcd(int a, int b) {
//		      辗转相减法
      while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      }
      return b;
	} gcd {
//		      辗转相减法
      while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      }
      return b;
	} while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      } a!=b a b {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      } if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          } a>b a b {
              a=a-b;
          } a=a-b a a-b a b {
              b=b-a;
          } b=b-a b b-a b a return b; b int a a int b b private static int gcd(int a, int b, int c) {
		int gcd1 = gcd(a,b);
		return gcd(gcd1, c);
	} gcd {
		int gcd1 = gcd(a,b);
		return gcd(gcd1, c);
	} int gcd1 = gcd(a,b); gcd1 gcd(a,b) gcd a b return gcd(gcd1, c); gcd(gcd1, c) gcd gcd1 c int a a int b b int c c public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[201];
		sum[1] = 1;
		for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		}
		System.out.println(sum[n]);
	}

	private static int gcd(int a, int b) {
//		      辗转相减法
      while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      }
      return b;
	}


	private static int gcd(int a, int b, int c) {
		int gcd1 = gcd(a,b);
		return gcd(gcd1, c);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[201];
		sum[1] = 1;
		for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		}
		System.out.println(sum[n]);
	}

	private static int gcd(int a, int b) {
//		      辗转相减法
      while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      }
      return b;
	}


	private static int gcd(int a, int b, int c) {
		int gcd1 = gcd(a,b);
		return gcd(gcd1, c);
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] sum = new int[201];
		sum[1] = 1;
		for (int i = 2; i <= n; i++) {
			sum[i]+= sum[i-1];
			for (int j = 1; j <= i ; j++) {
				for (int k = 1; k <= i ; k++) {
					for (int l = 1; l <= i; l++) {
						if (j == i || k == i || l ==i) {
							sum[i] += gcd(j,k,l);
						}
					}
				}
			}
		}
		System.out.println(sum[n]);
	}

	private static int gcd(int a, int b) {
//		      辗转相减法
      while(a!=b) {
          if(a>b) {
              a=a-b;
          }else {
              b=b-a;
          }
      }
      return b;
	}


	private static int gcd(int a, int b, int c) {
		int gcd1 = gcd(a,b);
		return gcd(gcd1, c);
	}
}
