#include <bits/stdc++.h>
using namespace std;
long long n;
string s;
long long f[1 << 20];
void FWT(long long f[], int n) {
  int N = 1 << n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < N; j++) {
      if (j & (1 << i)) continue;
      long long x = f[j], y = f[j | (1 << i)];
      f[j] = (x + y * 2) % 1000000007,
      f[j | (1 << i)] = (2 * x + y) % 1000000007;
    }
  }
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  long long N = s.size();
  for (long long(i) = (0); (i) <= (N - 1); (i)++) f[i] = s[i] % 2;
  FWT(f, n);
  long long ans = 0;
  for (long long(i) = (0); (i) <= (N - 1); (i)++)
    if (s[i] == '0') ans += f[i], ans %= 1000000007;
  ans *= 3, ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
