#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  long long sum = 1;
  for (long long i = 2; i <= n; i++) {
    sum += 4 * (i - 1);
  }
  cout << sum << endl;
}
