Number of Relations that are both Irreflexive and Antisymmetric on a Set

Given a positive integer N, the task is to find the number of relations that are irreflexive antisymmetric relations that can be formed over the given set of elements.  Since the count can be very large, print it to modulo 109 + 7.A relation R on a set A is called reflexive if no (a, a) € R holds for every element a € A.For Example: If set A = {a, b} then R = {(a, b), (b, a)} is irreflexive relation.A relation R on a set A is called Antisymmetric if and only if (a, b) € R and (b, a) € R, then a = b is called antisymmetric, i.e., the relation R = {(a, b)→ R | a ≤ b} is anti-symmetric, since a ≤ b and b ≤ a implies a = b.Examples:Input: N = 2Output: 3Explanation: Considering the set {a, b}, all possible relations that are both irreflexive and antisymmetric relations are:{}{{a, b}}{{b, a}} Input: N = 5Output: 59049Approach: The given problem can be solved based on the following observations:A relation R on a set A is a subset of the Cartesian Product of a set, i.e., A * A with N2 elements.No (x, x) pair should be included in the subset to make sure the relation is irreflexive.For the remaining (N2 – N) pairs, divide them into (N2 – N)/2 groups where each group consists of a pair (x, y) and its symmetric pair (y, x).Now, there are three choices, either include one of the ordered pairs or neither of them from a group.Therefore, the total number of possible relations that are both irreflexive and antisymmetric is given by 3(N2 – N)/2.Below is the implementation of the above approach:C++  #include using namespace std;  const int mod = 1000000007;  int power(long long x, unsigned int y){        int res = 1;          x = x % mod;      while (y > 0) {                          if (y & 1)            res = (res * x) % mod;                  y = y >> 1;                  x = (x * x) % mod;    }          return res;}  int numberOfRelations(int N){        return power(3, (N * N – N) / 2);}  int main(){    int N = 2;    cout