	#include <bits/stdc++.h>
using namespace std;
int yaku(int a, int b)
{int hozon = 1;
  int wari =1;
  for(int i=0;i<max(a,b);i++){
  
  int c = a;
  int d = b;
  c/=wari;
  c*=wari;
  d/=wari;
  d*=wari;
  if(a==c&&b==d)
  {hozon=wari;}
  wari++;}
 return hozon;
  
}
int main() {
  int n;
  cin >> n ;
  int total = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1;j<=n;j++){
      for(int k = 1;k<=n;k++){
        int m=yaku(j,k);
        total += yaku(i,m);
        }
    }
  }
          
    
      
  cout << total <<endl;}

