#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("expensive-optimizations")
using namespace std;
constexpr int INFi = INT_MAX;
constexpr unsigned int INFui = UINT_MAX;
constexpr long long INFll = LLONG_MAX;
constexpr unsigned long long INFull = ULLONG_MAX;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, res = 1;
  cin >> n;
  for (int i = 2; i <= n; i++) res += 4 * (i - 1);
  cout << res;
  return 0;
}
