#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using mii = map<int, int>;
using pqls = priority_queue<long long>;
using pqlg = priority_queue<long long, vector<long long>, greater<long long>>;
using mll = map<long long, long long>;
using pll = pair<long long, long long>;
using sll = set<long long>;
long long divup(long long a, long long b);
long long kaijou(long long i);
long long P(long long n, long long k);
long long C(long long n, long long k);
long long GCD(long long a, long long b);
long long LCM(long long a, long long b);
bool prime(long long N);
double distance(vector<long long> p, vector<long long> q, long long n);
void press(vector<long long> &v);
void ranking(vector<long long> &v);
void erase(vector<long long> &v, long long i);
void unique(vector<long long> &v);
void printv(vector<long long> v);
vector<ll> keta(ll x);
long long modpow(long long a, long long n, long long mod);
long long modinv(long long a, long long mod);
vector<long long> inputv(long long n);
vector<long long> yakusuu(int n);
map<long long, long long> soinsuu(long long n);
vector<vector<long long>> maze(long long i, long long j, vector<string> &s);
vector<long long> eratos(long long n);
set<long long> eraset(long long n);
long long divup(long long a, long long b) {
  long long x = abs(a);
  long long y = abs(b);
  long long z = (x + y - 1) / y;
  if ((a < 0 && b > 0) || (a > 0 && b < 0))
    return -z;
  else if (a == 0)
    return 0;
  else
    return z;
}
long long kaijou(long long i) {
  if (i == 0) return 1;
  long long j = 1;
  for (long long k = 1; k <= i; k++) {
    j *= k;
  }
  return j;
}
long long P(long long n, long long k) {
  if (n < k) return 0;
  long long y = 1;
  for (long long i = 0; i < k; i++) {
    y *= (n - i);
  }
  return y;
}
long long C(long long n, long long k) {
  if (n < k) return 0;
  return P(n, k) / kaijou(k);
}
long long GCD(long long a, long long b) {
  if (a < b) swap(a, b);
  long long d = a % b;
  if (d == 0) {
    return b;
  }
  return GCD(b, d);
}
long long LCM(long long a, long long b) { return (a / GCD(a, b)) * b; }
bool prime(long long N) {
  if (N == 1) {
    return false;
  }
  if (N < 0) return false;
  long long p = sqrt(N);
  for (long long i = 2; i <= p; i++) {
    if (N % i == 0) {
      return false;
    }
  }
  return true;
}
double distance(vector<long long> p, vector<long long> q, long long n) {
  double x = 0;
  for (long long i = 0; i < n; i++) {
    x += pow((p.at(i) - q.at(i)), 2);
  }
  return sqrt(x);
}
void press(vector<long long> &v) {
  long long n = v.size();
  vector<long long> w(n);
  map<long long, long long> m;
  for (auto &p : v) {
    m[p] = 0;
  }
  long long i = 0;
  for (auto &p : m) {
    p.second = i;
    i++;
  }
  for (long long i = 0; i < n; i++) {
    w.at(i) = m[v.at(i)];
  }
  v = w;
  return;
}
void ranking(vector<long long> &v) {
  long long n = v.size();
  map<long long, long long> m;
  long long i;
  for (i = 0; i < n; i++) {
    m[v.at(i)] = i;
  }
  vector<long long> w(n);
  i = 0;
  for (auto &p : m) {
    v.at(i) = p.second;
    i++;
  }
  return;
}
void erase(vector<long long> &v, long long i) {
  long long n = v.size();
  if (i > n - 1) return;
  for (long long j = i; j < n - 1; j++) {
    v.at(j) = v.at(j + 1);
  }
  v.pop_back();
  return;
}
void unique(vector<long long> &v) {
  long long n = v.size();
  set<long long> s;
  long long i = 0;
  while (i < n) {
    if (s.count(v.at(i))) {
      erase(v, i);
      n--;
    } else {
      s.insert(v.at(i));
      i++;
    }
  }
  return;
}
void printv(vector<long long> v) {
  cout << "{ ";
  for (auto &p : v) {
    cout << p << ",";
  }
  cout << "}" << endl;
}
vector<ll> keta(ll x) {
  if (x == 0) return {0};
  ll n = log10(x) + 1;
  vll w(n, 0);
  for (ll i = 0; i < n; i++) {
    ll p;
    p = x % 10;
    x = x / 10;
    w[n - 1 - i] = p;
  }
  return w;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod) { return modpow(a, mod - 2, mod); }
vector<long long> inputv(long long n) {
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  return v;
}
vector<long long> yakusuu(long long n) {
  vector<long long> ret;
  for (long long i = 1; i <= sqrt(n); ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}
map<long long, long long> soinsuu(long long n) {
  map<long long, long long> m;
  long long p = sqrt(n);
  while (n % 2 == 0) {
    n /= 2;
    if (m.count(2)) {
      m[2]++;
    } else {
      m[2] = 1;
    }
  }
  for (long long i = 3; i * i <= n; i += 2) {
    while (n % i == 0) {
      n /= i;
      if (m.count(i)) {
        m[i]++;
      } else {
        m[i] = 1;
      }
    }
  }
  if (n != 1) m[n] = 1;
  return m;
}
vector<vector<long long>> maze(ll i, ll j, vector<string> &s) {
  ll h = s.size();
  ll w = s[0].size();
  queue<vector<long long>> q;
  vector<vector<long long>> dis(h, vll(w, -1));
  q.push({i, j});
  dis[i][j] = 0;
  while (!q.empty()) {
    auto v = q.front();
    q.pop();
    if (v[0] > 0 && s[v[0] - 1][v[1]] == '.' && dis[v[0] - 1][v[1]] == -1) {
      dis[v[0] - 1][v[1]] = dis[v[0]][v[1]] + 1;
      q.push({v[0] - 1, v[1]});
    }
    if (v[1] > 0 && s[v[0]][v[1] - 1] == '.' && dis[v[0]][v[1] - 1] == -1) {
      dis[v[0]][v[1] - 1] = dis[v[0]][v[1]] + 1;
      q.push({v[0], v[1] - 1});
    }
    if (v[0] < h - 1 && s[v[0] + 1][v[1]] == '.' && dis[v[0] + 1][v[1]] == -1) {
      dis[v[0] + 1][v[1]] = dis[v[0]][v[1]] + 1;
      q.push({v[0] + 1, v[1]});
    }
    if (v[1] < w - 1 && s[v[0]][v[1] + 1] == '.' && dis[v[0]][v[1] + 1] == -1) {
      dis[v[0]][v[1] + 1] = dis[v[0]][v[1]] + 1;
      q.push({v[0], v[1] + 1});
    }
  }
  return dis;
}
long long modC(long long n, long long k, long long mod) {
  if (n < k) return 0;
  long long p = 1, q = 1;
  for (long long i = 0; i < k; i++) {
    p = p * (n - i) % mod;
    q = q * (i + 1) % mod;
  }
  return p * modinv(q, mod) % mod;
}
long long POW(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a;
    a = a * a;
    n >>= 1;
  }
  return res;
}
vector<long long> eratos(long long n) {
  if (n < 2) return {};
  vll v(n - 1);
  for (long long i = 0; i < n - 1; i++) {
    v[i] = i + 2;
  }
  ll i = 0;
  while (i < n - 1) {
    ll p = v[i];
    for (ll j = i + 1; j < n - 1; j++) {
      if (v[j] % p == 0) {
        v.erase(v.begin() + j);
        n--;
      }
    }
    i++;
  }
  v.resize(n - 1);
  return v;
}
set<long long> eraset(long long n) {
  set<long long> s;
  vll v = eratos(n);
  for (auto &t : v) {
    s.insert(t);
  }
  return s;
}
int main() {
  ll n;
  cin >> n;
  auto a = inputv(n);
  vll v(60, 0);
  for (long long i = 0; i < 60; i++) {
    for (long long j = 0; j < n; j++) {
      v[i] += (1 & (a[j] >> i));
    }
  }
  for (long long i = 0; i < 60; i++) {
    v[i] = v[i] * (n - v[i]);
  }
  ll const mod = 1e9 + 7;
  ll res = 0;
  for (long long i = 0; i < 60; i++) {
    res += modpow(2, i, mod) * v[i] % mod;
    res %= mod;
  }
  while (res < 0) res += mod;
  cout << res << endl;
}
