#include <bits/stdc++.h>
using namespace std;
int a[18257 + 5] = {0, 1, 13, 37, 73}, n;
int main() {
  cin >> n;
  for (int i = 5; i <= n; i++) {
    a[i] = a[i - 1] + (a[i - 1] - a[i - 2] + 12);
  }
  cout << a[n];
}
