#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int dp[n + 1];
  dp[0] = 0;
  dp[1] = 1;
  dp[2] = 5;
  for (long long int i = 3; i <= n; i++) {
    dp[i] = (i - 1) * 4 + dp[i - 1];
  }
  cout << dp[n];
}
